diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2007-03-08 18:58:21 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2007-03-08 18:58:21 +0000 |
commit | 5e48678fa4a6501ed5025e592c4bb955e325d0c8 (patch) | |
tree | 1724f0ab9f9fb298a8623748ae80f9fb4943548b /ACE/ace/Time_Value.cpp | |
parent | 08f608cb5cc4c09ebe466ef6bd0f7e7f0ef35293 (diff) | |
download | ATCD-5e48678fa4a6501ed5025e592c4bb955e325d0c8.tar.gz |
ChangeLogTag:Thu Mar 8 18:06:14 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'ACE/ace/Time_Value.cpp')
-rw-r--r-- | ACE/ace/Time_Value.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ACE/ace/Time_Value.cpp b/ACE/ace/Time_Value.cpp index ce88782b128..c65a2880e7a 100644 --- a/ACE/ace/Time_Value.cpp +++ b/ACE/ace/Time_Value.cpp @@ -235,18 +235,16 @@ ACE_Time_Value::operator *= (double d) float_type time_sec = static_cast<float_type> (this->sec ()) * d; float_type time_usec = static_cast<float_type> (this->usec ()) * d; - // Shall we saturate the result? float_type const max_time_t = - ACE_Numeric_Limits<time_t>::max () + static_cast<float_type> (0.999999); + static_cast<float_type> (ACE_Numeric_Limits<time_t>::max ()); float_type const min_time_t = - ACE_Numeric_Limits<time_t>::min () - static_cast<float_type> (0.999999); + static_cast<float_type> (ACE_Numeric_Limits<time_t>::min ()); + // -999999 to 999999 microseconds float_type const max_suseconds_t = - ACE_Numeric_Limits<suseconds_t>::max () - + static_cast<float_type> (0.999999); + static_cast<float_type> (ACE_Numeric_Limits<suseconds_t>::max ()); float_type const min_suseconds_t = - ACE_Numeric_Limits<suseconds_t>::min () - - static_cast<float_type> (0.999999); + static_cast<float_type> (ACE_Numeric_Limits<suseconds_t>::min ()); // Truncate if necessary. if (time_sec > max_time_t) @@ -266,9 +264,13 @@ ACE_Time_Value::operator *= (double d) static float_type const roundup_threshold = 0.5; // Always 0.5. // round up the result to save the last usec - if (useconds > 0 && usec_diff >= roundup_threshold) + if (useconds > 0 + && time_usec < max_suseconds_t + && usec_diff >= roundup_threshold) ++useconds; - else if (useconds < 0 && usec_diff <= -roundup_threshold) + else if (useconds < 0 + && time_usec > min_suseconds_t + && usec_diff <= -roundup_threshold) --useconds; this->set (seconds, useconds); |