diff --git a/repos/base-hw/src/core/spec/arm/cortex_a9_global_timer.cc b/repos/base-hw/src/core/spec/arm/cortex_a9_global_timer.cc index 62b9602991..242b0fe235 100644 --- a/repos/base-hw/src/core/spec/arm/cortex_a9_global_timer.cc +++ b/repos/base-hw/src/core/spec/arm/cortex_a9_global_timer.cc @@ -102,7 +102,7 @@ unsigned Timer::interrupt_id() const { time_t Timer::us_to_ticks(time_t const us) const { - return (us / 1000) * TICS_PER_MS; } + return (us * TICS_PER_MS) / 1000; } time_t Timer::_duration() const { diff --git a/repos/base-hw/src/core/spec/arm/generic_timer.cc b/repos/base-hw/src/core/spec/arm/generic_timer.cc index efdc010751..0d702cecd3 100644 --- a/repos/base-hw/src/core/spec/arm/generic_timer.cc +++ b/repos/base-hw/src/core/spec/arm/generic_timer.cc @@ -58,7 +58,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const { time_t Timer::us_to_ticks(time_t const us) const { - return (us / 1000) * _device.ticks_per_ms; } + return (us * _device.ticks_per_ms) / 1000; } time_t Timer::_max_value() const { diff --git a/repos/base-hw/src/core/spec/arm/imx_epit.cc b/repos/base-hw/src/core/spec/arm/imx_epit.cc index 5145c265c5..6854f90c94 100644 --- a/repos/base-hw/src/core/spec/arm/imx_epit.cc +++ b/repos/base-hw/src/core/spec/arm/imx_epit.cc @@ -84,7 +84,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const { time_t Timer::us_to_ticks(time_t const us) const { - return (us / 1000UL) * Board::Timer::TICS_PER_MS; } + return (us * Board::Timer::TICS_PER_MS) / 1000; } time_t Timer::_max_value() const { diff --git a/repos/base-hw/src/core/spec/x86_64/pit.cc b/repos/base-hw/src/core/spec/x86_64/pit.cc index 60bdb5662d..bb895b9084 100644 --- a/repos/base-hw/src/core/spec/x86_64/pit.cc +++ b/repos/base-hw/src/core/spec/x86_64/pit.cc @@ -109,7 +109,7 @@ time_t Timer::ticks_to_us(time_t const ticks) const { time_t Timer::us_to_ticks(time_t const us) const { - return (us / 1000) * _device.ticks_per_ms; } + return (us * _device.ticks_per_ms) / 1000; } time_t Timer::_max_value() const {