diff --git a/repos/os/include/timer_session/connection.h b/repos/os/include/timer_session/connection.h index 7f801cd7de..7a6535029e 100644 --- a/repos/os/include/timer_session/connection.h +++ b/repos/os/include/timer_session/connection.h @@ -192,6 +192,7 @@ class Timer::Connection : public Genode::Connection, enum { MAX_INTERPOLATION_QUALITY = 3 }; enum { MAX_REMOTE_TIME_LATENCY_US = 500 }; enum { MAX_REMOTE_TIME_TRIALS = 5 }; + enum { MIN_FACTOR_LOG2 = 8 }; Genode::Io_signal_handler _signal_handler; diff --git a/repos/os/src/lib/timeout/timer_connection_time.cc b/repos/os/src/lib/timeout/timer_connection_time.cc index f06d027cd7..4e52e6159b 100644 --- a/repos/os/src/lib/timeout/timer_connection_time.cc +++ b/repos/os/src/lib/timeout/timer_connection_time.cc @@ -85,8 +85,6 @@ void Timer::Connection::_update_real_time() * Update timestamp-to-time factor and its shift */ - enum { MAX_FACTOR_SHIFT = sizeof(unsigned long) * 8 }; - unsigned factor_shift = _us_to_ts_factor_shift; unsigned long old_factor = _us_to_ts_factor; Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift; @@ -138,8 +136,7 @@ void Timer::Connection::_update_real_time() * raise the shift successively to get as much precision as possible. */ Timestamp ts_diff_shifted = ts_diff << factor_shift; - while (ts_diff_shifted <= min_ts_diff_shifted && - factor_shift < MAX_FACTOR_SHIFT) + while (ts_diff_shifted < us_diff << MIN_FACTOR_LOG2) { factor_shift++; ts_diff_shifted <<= 1;