# HG changeset patch # User asl # Date 1065296837 0 # Node ID ff92dea1b818d03812ad004a730f09bf0f307f0f # Parent 548125f9b00020d35ef4b3dbec33b617ab5f8e9b * src/emulate.cxx (get_hw_seconds): Modified the ticks-to-seconds conversion in the wallclock emulator's get_hw_seconds() function. The previous implementation would easily overflow for any reasonable date/tick-resolution combinations. diff --git a/packages/io/wallclock/current/ChangeLog b/packages/io/wallclock/current/ChangeLog --- a/packages/io/wallclock/current/ChangeLog +++ b/packages/io/wallclock/current/ChangeLog @@ -1,3 +1,10 @@ +2003-09-23 Dan Jakubiec + + * src/emulate.cxx (get_hw_seconds): Modified the ticks-to-seconds + conversion in the wallclock emulator's get_hw_seconds() function. + The previous implementation would easily overflow for any + reasonable date/tick-resolution combinations. + 2003-09-19 Gary Thomas * tests/wallclock.cxx: Allow test to complete, even if it looses sync. diff --git a/packages/io/wallclock/current/src/emulate.cxx b/packages/io/wallclock/current/src/emulate.cxx --- a/packages/io/wallclock/current/src/emulate.cxx +++ b/packages/io/wallclock/current/src/emulate.cxx @@ -85,7 +85,7 @@ Cyg_WallClock::get_hw_seconds( void ) cyg_tick_count secs = Cyg_Clock::real_time_clock->current_value() - epoch_ticks; - secs = ( secs * res.dividend ) / ( res.divisor * 1000000000LL ) ; + secs = secs / ( ( res.divisor * 1000000000LL ) / res.dividend ); return secs; }