diff options
author | Steve Huston <shuston@riverace.com> | 2001-09-12 19:17:13 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2001-09-12 19:17:13 +0000 |
commit | f90211f8c807c2dc91adbdd494b55ae208796701 (patch) | |
tree | 20f696fe7dacde5959006ef0b54629f28718a3d8 /ace/High_Res_Timer.cpp | |
parent | e73b726fa701c524d3f873679e0409018a929850 (diff) | |
download | ATCD-f90211f8c807c2dc91adbdd494b55ae208796701.tar.gz |
ChangeLogTag:Wed Sep 12 15:10:41 2001 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace/High_Res_Timer.cpp')
-rw-r--r-- | ace/High_Res_Timer.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index b3ac1641913..89840f40cc1 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -375,14 +375,18 @@ ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const { // 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. + // native 64-bit ints. In particular, division can be a problem. + // For more background on this, please see bugzilla #1024. #if defined (ACE_WIN32) nanoseconds = (this->end_ - this->start_) - * (1000000u / ACE_High_Res_Timer::global_scale_factor ()); + * (1024000000u / ACE_High_Res_Timer::global_scale_factor()); #else nanoseconds = (this->end_ - this->start_) - * (1000u / ACE_High_Res_Timer::global_scale_factor ()); + * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); #endif /* ACE_WIN32 */ + nanoseconds >>= 10; + // Right shift is implemented for non native 64-bit ints + // operator/ only for a 32 bit result ! } void @@ -391,11 +395,12 @@ ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const // Same as above. #if defined (ACE_WIN32) nanoseconds = this->total_ - / ACE_High_Res_Timer::global_scale_factor () * 1000000u; + * (1024000000u / ACE_High_Res_Timer::global_scale_factor()); #else nanoseconds = this->total_ - / ACE_High_Res_Timer::global_scale_factor () * 1000u; + * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); #endif + nanoseconds >>= 10; } #if !defined (ACE_HAS_WINCE) |