diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-17 23:06:39 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-17 23:06:39 +0000 |
commit | 09278d2fa78ab9a84fa4b645e7ab2da3df258cf6 (patch) | |
tree | f30e46b6c7ff07f43ad717c336ddea8c4517b439 /ace/High_Res_Timer.cpp | |
parent | 3df11168801175180b6eb6d9ab20d20b9abd9f32 (diff) | |
download | ATCD-09278d2fa78ab9a84fa4b645e7ab2da3df258cf6.tar.gz |
(elapsed_time): rearranged terms in nanoseconds calculation to avoid
overflow on machines that don't have native 64-bit ints.
Diffstat (limited to 'ace/High_Res_Timer.cpp')
-rw-r--r-- | ace/High_Res_Timer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index 4bfafcf2c84..e2037319031 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -279,7 +279,10 @@ ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) void ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) { - nanoseconds = (this->end_ - this->start_) * 1000u / global_scale_factor (); + // Please do _not_ rearrange this equation. It is carefully + // designed and tested to avoid overflow on machines that + // don't have native 64-bit ints. + nanoseconds = (this->end_ - this->start_) * (1000u / global_scale_factor ()); } #if !defined (ACE_HAS_WINCE) |