diff --git a/repos/os/include/timer_session/connection.h b/repos/os/include/timer_session/connection.h index 4f7a99b3bd..7f801cd7de 100644 --- a/repos/os/include/timer_session/connection.h +++ b/repos/os/include/timer_session/connection.h @@ -197,9 +197,9 @@ class Timer::Connection : public Genode::Connection, Timeout_handler *_handler { nullptr }; Lock _real_time_lock { Lock::UNLOCKED }; - unsigned long _ms { elapsed_ms() }; + unsigned long _us { elapsed_us() }; Timestamp _ts { _timestamp() }; - Duration _real_time { Milliseconds(_ms) }; + Duration _real_time { Microseconds(_us) }; Duration _interpolated_time { _real_time }; unsigned _interpolation_quality { 0 }; unsigned long _us_to_ts_factor { 1UL }; diff --git a/repos/os/src/lib/timeout/arm/timer_connection_time.cc b/repos/os/src/lib/timeout/arm/timer_connection_time.cc index e5c07f0cef..7a0ed6a097 100644 --- a/repos/os/src/lib/timeout/arm/timer_connection_time.cc +++ b/repos/os/src/lib/timeout/arm/timer_connection_time.cc @@ -28,5 +28,5 @@ void Timer::Connection::_update_real_time() { } Duration Timer::Connection::curr_time() { - return Duration(Milliseconds(elapsed_ms())); + return Duration(Microseconds(elapsed_us())); } diff --git a/repos/os/src/lib/timeout/timer_connection.cc b/repos/os/src/lib/timeout/timer_connection.cc index b06ec5b713..6cdb03b014 100644 --- a/repos/os/src/lib/timeout/timer_connection.cc +++ b/repos/os/src/lib/timeout/timer_connection.cc @@ -87,12 +87,12 @@ Duration Timer::Connection::_update_interpolated_time(Duration &interpolated_tim void Timer::Connection::_handle_timeout() { - unsigned long const ms = elapsed_ms(); - if (ms - _ms > REAL_TIME_UPDATE_PERIOD_US / 1000UL) { + unsigned long const us = elapsed_us(); + if (us - _us > REAL_TIME_UPDATE_PERIOD_US) { _update_real_time(); } if (_handler) { - _handler->handle_timeout(Duration(Milliseconds(ms))); + _handler->handle_timeout(Duration(Microseconds(us))); } } diff --git a/repos/os/src/lib/timeout/timer_connection_time.cc b/repos/os/src/lib/timeout/timer_connection_time.cc index f4f6409fce..f06d027cd7 100644 --- a/repos/os/src/lib/timeout/timer_connection_time.cc +++ b/repos/os/src/lib/timeout/timer_connection_time.cc @@ -29,7 +29,7 @@ void Timer::Connection::_update_real_time() */ Timestamp ts = 0UL; - unsigned long ms = 0UL; + unsigned long us = 0UL; unsigned long latency_us = ~0UL; /* @@ -43,14 +43,14 @@ void Timer::Connection::_update_real_time() { /* read out the two time values close in succession */ Timestamp volatile new_ts = _timestamp(); - unsigned long volatile new_ms = elapsed_ms(); + unsigned long volatile new_us = elapsed_us(); /* * If interpolation is not ready, yet we cannot determine a latency * and take the values as they are. */ if (_interpolation_quality < MAX_INTERPOLATION_QUALITY) { - ms = new_ms; + us = new_us; ts = new_ts; break; } @@ -61,7 +61,7 @@ void Timer::Connection::_update_real_time() /* remember results if the latency was better than on the last trial */ if (new_latency_us < latency_us) { - ms = new_ms; + us = new_us; ts = new_ts; /* take the results if the latency fulfills the given maximum */ @@ -72,13 +72,13 @@ void Timer::Connection::_update_real_time() } /* determine timestamp and time difference */ - unsigned long const ms_diff = ms - _ms; + unsigned long const us_diff = us - _us; Timestamp ts_diff = ts - _ts; /* overwrite timestamp, time, and real time member */ - _ms = ms; + _us = us; _ts = ts; - _real_time += Milliseconds(ms_diff); + _real_time += Microseconds(us_diff); /* @@ -87,11 +87,10 @@ void Timer::Connection::_update_real_time() enum { MAX_FACTOR_SHIFT = sizeof(unsigned long) * 8 }; - unsigned factor_shift = _us_to_ts_factor_shift; - unsigned long old_factor = _us_to_ts_factor; - unsigned long const us_diff = ms_diff * 1000UL; - Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift; - Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1; + unsigned factor_shift = _us_to_ts_factor_shift; + unsigned long old_factor = _us_to_ts_factor; + Timestamp max_ts_diff = ~(Timestamp)0ULL >> factor_shift; + Timestamp min_ts_diff_shifted = ~(Timestamp)0ULL >> 1; /* * If the calculation type is bigger than the resulting factor type, @@ -204,7 +203,7 @@ Duration Timer::Connection::curr_time() } else { /* use remote timer instead of timestamps */ - interpolated_time += Milliseconds(elapsed_ms() - _ms); + interpolated_time += Microseconds(elapsed_us() - _us); lock_guard.destruct(); }