From 40bab7b8c1757de8ea09491dd259320f3b8ba473 Mon Sep 17 00:00:00 2001 From: "Erling R. Jellum" Date: Mon, 13 May 2024 10:26:21 -0700 Subject: [PATCH] Dont apply/subtract clock sync offset from NEVER/FOREVER --- core/federated/clock-sync.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/federated/clock-sync.c b/core/federated/clock-sync.c index 2a6ce8e3d3..920758658d 100644 --- a/core/federated/clock-sync.c +++ b/core/federated/clock-sync.c @@ -531,9 +531,17 @@ void* listen_to_rti_UDP_thread(void* args) { // If clock synchronization is enabled, provide implementations. If not // just empty implementations that should be optimized away. #if defined(_LF_CLOCK_SYNC_ON) || defined(_LF_CLOCK_SYNC_INITIAL) -void clock_sync_add_offset(instant_t* t) { *t += (_lf_clock_sync_offset + _lf_clock_sync_constant_bias); } +void clock_sync_add_offset(instant_t* t) { + if (*t != FOREVER && *t != NEVER) { + *t += (_lf_clock_sync_offset + _lf_clock_sync_constant_bias); + } +} -void clock_sync_subtract_offset(instant_t* t) { *t -= (_lf_clock_sync_offset + _lf_clock_sync_constant_bias); } +void clock_sync_subtract_offset(instant_t* t) { + if (*t != FOREVER && *t != NEVER) { + *t -= (_lf_clock_sync_offset + _lf_clock_sync_constant_bias); + } +} void clock_sync_set_constant_bias(interval_t offset) { _lf_clock_sync_constant_bias = offset; } #else