#2042: ntp_client test fixes.
This commit is contained in:
@@ -89,8 +89,7 @@ class NTPClient(Service):
|
|||||||
if not (isinstance(payload, NTPPacket) and payload.ntp_request.ntp_client):
|
if not (isinstance(payload, NTPPacket) and payload.ntp_request.ntp_client):
|
||||||
_LOGGER.debug(f"{payload} is not a NTPPacket")
|
_LOGGER.debug(f"{payload} is not a NTPPacket")
|
||||||
return False
|
return False
|
||||||
|
print(f">>>>>>>>>>>>>>>>>> payload.ntp_reply.ntp_datetime {payload.ntp_reply.ntp_datetime}")
|
||||||
# XXX: compare received datetime with current time. Log error if differ by more than x ms?
|
|
||||||
if payload.ntp_reply.ntp_datetime:
|
if payload.ntp_reply.ntp_datetime:
|
||||||
self.sys_log.info(
|
self.sys_log.info(
|
||||||
f"{self.name}: Received time \
|
f"{self.name}: Received time \
|
||||||
@@ -112,8 +111,9 @@ class NTPClient(Service):
|
|||||||
super().apply_timestep(timestep)
|
super().apply_timestep(timestep)
|
||||||
if self.operating_state == ServiceOperatingState.RUNNING:
|
if self.operating_state == ServiceOperatingState.RUNNING:
|
||||||
# request time from server
|
# request time from server
|
||||||
ntp_request = NTPPacket(NTPRequest())
|
ntp_request = NTPRequest(ntp_client=self.ip_addr)
|
||||||
self.send(ntp_request)
|
ntp_server_packet = NTPPacket(ntp_request=ntp_request)
|
||||||
|
self.send(payload=ntp_server_packet)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.sys_log.debug(f"{self.name} ntp client not running")
|
self.sys_log.debug(f"{self.name} ntp client not running")
|
||||||
|
|||||||
Reference in New Issue
Block a user