diff --git a/meson_options.txt b/meson_options.txt index d5237f02ae..814f340840 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -223,7 +223,7 @@ option('status-unit-format-default', type : 'combo', option('time-epoch', type : 'integer', value : 0, description : 'time epoch for time clients') option('clock-valid-range-usec-max', type : 'integer', value : 473364000000000, # 15 years - description : 'maximum value in microseconds for the difference between RTC and epoch, exceeding which is considered an RTC error') + description : 'maximum value in microseconds for the difference between RTC and epoch, exceeding which is considered an RTC error ["0" disables]') option('default-user-shell', type : 'string', value : '/bin/bash', description : 'default interactive shell') diff --git a/src/shared/clock-util.c b/src/shared/clock-util.c index eb6f12a255..a4c00d713e 100644 --- a/src/shared/clock-util.c +++ b/src/shared/clock-util.c @@ -153,7 +153,7 @@ int clock_apply_epoch(ClockChangeDirection *ret_attempted_change) { now_usec = now(CLOCK_REALTIME); if (now_usec < epoch_usec) *ret_attempted_change = CLOCK_CHANGE_FORWARD; - else if (now_usec > usec_add(epoch_usec, CLOCK_VALID_RANGE_USEC_MAX)) + else if (CLOCK_VALID_RANGE_USEC_MAX > 0 && now_usec > usec_add(epoch_usec, CLOCK_VALID_RANGE_USEC_MAX)) *ret_attempted_change = CLOCK_CHANGE_BACKWARD; else { *ret_attempted_change = CLOCK_CHANGE_NOOP;