Fix the issue that a Freerun event might be posted at the end of holdover timer

The code now rounds the time that the PHC is in holdover
Before it was waiting an additional time to produce the
event because of the precision digits

Partial-Bug: 1924201

Signed-off-by: Udi Schwager <udi.schwager@windriver.com>
Change-Id: I77ecfe6c7eebf2a40cab5376878adefadb32d526
This commit is contained in:
Udi Schwager 2021-04-16 16:29:19 -04:00
parent 5e0e557796
commit b492aaab50

View File

@ -136,7 +136,7 @@ def ptp_status(holdover_time, freq, sync_state, event_time):
# Freerun —> Locked #
####################################
current_time = datetime.datetime.now().timestamp()
time_in_holdover = current_time - event_time
time_in_holdover = round(current_time - event_time)
previous_sync_state = sync_state
# max holdover time is calculated to be in a 'safety' zoon
max_holdover_time = (holdover_time - freq * 2)