diff options
Diffstat (limited to 'ace/High_Res_Timer.cpp')
-rw-r--r-- | ace/High_Res_Timer.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index 28919373da5..b670b68123d 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -34,8 +34,8 @@ void ACE_High_Res_Timer::elapsed_time (ACE_Time_Value &tv) { if (scale_factor_ > 0) { - tv.sec ((this->end_ - this->start_) / 1000000L / scale_factor_); - tv.usec ((this->end_ - this->start_) % 1000000L / scale_factor_); + tv.sec ((ACE_hrtime_t) ((this->end_ - this->start_) / 1000000L / scale_factor_)); + tv.usec ((ACE_hrtime_t) ((this->end_ - this->start_) % 1000000L / scale_factor_)); } else { tv.sec ((this->end_ - this->start_) / 1000000L); tv.usec ((this->end_ - this->start_) % 1000000L); @@ -47,10 +47,8 @@ void ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) { if (scale_factor_ > 0) { - elapsed_time.tv_sec = (this->end_ - this->start_) / (1000 * 1000 * 1000) / - scale_factor_; - elapsed_time.tv_nsec = (this->end_ - this->start_) % (1000 * 1000 * 1000) / - scale_factor_; + elapsed_time.tv_sec = (ACE_hrtime_t) ((this->end_ - this->start_) / (1000 * 1000 * 1000) / scale_factor_); + elapsed_time.tv_nsec = (ACE_hrtime_t) ((this->end_ - this->start_) % (1000 * 1000 * 1000) / scale_factor_); } else { elapsed_time.tv_sec = (this->end_ - this->start_) / (1000 * 1000 * 1000); elapsed_time.tv_nsec = (this->end_ - this->start_) % (1000 * 1000 * 1000); @@ -62,8 +60,8 @@ void ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) { if (scale_factor_ > 0) { - tv.sec (this->total_ / 1000000L / scale_factor_); - tv.usec (this->total_ % 1000000L / scale_factor_); + tv.sec ((ACE_hrtime_t) (this->total_ / 1000000L / scale_factor_)); + tv.usec ((ACE_hrtime_t) (this->total_ % 1000000L / scale_factor_)); } else { tv.sec (this->total_ / 1000000L); tv.usec (this->total_ % 1000000L); @@ -76,7 +74,7 @@ ACE_High_Res_Timer::print_ave (const char *str, const int count, ACE_HANDLE hand ACE_TRACE ("ACE_High_Res_Timer::print_ave"); ACE_hrtime_t total; if (scale_factor_ > 0) - total = (this->end_ - this->start_) /scale_factor_; + total = (ACE_hrtime_t) ((this->end_ - this->start_) /scale_factor_); else total = this->end_ - this->start_; ACE_hrtime_t total_secs = total / (1000 * 1000 * 1000); @@ -104,7 +102,7 @@ ACE_High_Res_Timer::print_total (const char *str, const int count, ACE_HANDLE ha ACE_TRACE ("ACE_High_Res_Timer::print_total"); ACE_hrtime_t total_secs; if (scale_factor_ > 0) - total_secs = this->total_ / (1000 * 1000 * 1000) / scale_factor_; + total_secs = (ACE_hrtime_t) (this->total_ / (1000 * 1000 * 1000) / scale_factor_); else total_secs = this->total_ / (1000 * 1000 * 1000); u_long extra_nsecs = this->total_ % (1000 * 1000 * 1000); |