diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-11-20 06:52:53 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-11-20 06:52:53 +0000 |
commit | ec1eba13d3d12d9b068e24b1ad4eabd41c6dc48c (patch) | |
tree | 2591cbef6db606930920a59bd6f14f959a9b8e3b | |
parent | 16c68adbcb179470ecfb26d01f192f26b31326fb (diff) | |
download | ATCD-ec1eba13d3d12d9b068e24b1ad4eabd41c6dc48c.tar.gz |
ChangeLogTag:Tue Nov 19 22:36:38 2002 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 15 | ||||
-rw-r--r-- | ace/Time_Value.cpp | 23 | ||||
-rw-r--r-- | ace/Time_Value.h | 33 |
4 files changed, 71 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog index 9ff5ae0887a..d8da921f715 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Tue Nov 19 22:36:38 2002 Ossama Othman <ossama@uci.edu> + + * ace/Time_Value.h (sec, usec, msec): + + Documentation updates/clarifications. + + * ace/Time_Value.cpp (operator++, operator--): + + Fixed postfix increment and decrement operators. Previously + they had the same implementation as their prefix increment and + decrement operator counterparts. A copy of the ACE_Time_Value + is now done prior to incrementing it via the corresponding + prefix operator. That copy is returned. A copy is only + performed for the postfix case. + Tue Nov 19 18:14:10 2002 Pradeep Gore <pradeep@oomworks.com> * bin/auto_run_tests.lst: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 9ff5ae0887a..d8da921f715 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,18 @@ +Tue Nov 19 22:36:38 2002 Ossama Othman <ossama@uci.edu> + + * ace/Time_Value.h (sec, usec, msec): + + Documentation updates/clarifications. + + * ace/Time_Value.cpp (operator++, operator--): + + Fixed postfix increment and decrement operators. Previously + they had the same implementation as their prefix increment and + decrement operator counterparts. A copy of the ACE_Time_Value + is now done prior to incrementing it via the corresponding + prefix operator. That copy is returned. A copy is only + performed for the postfix case. + Tue Nov 19 18:14:10 2002 Pradeep Gore <pradeep@oomworks.com> * bin/auto_run_tests.lst: diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp index 5f1642865ff..f783c135acc 100644 --- a/ace/Time_Value.cpp +++ b/ace/Time_Value.cpp @@ -1,6 +1,7 @@ #include "ace/Time_Value.h" #include "ace/Basic_Types.h" + ACE_RCSID (ace, Time_Value, "$Id$") @@ -33,17 +34,17 @@ ACE_Time_Value ACE_Time_Value::operator ++ (int) { // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); - usec (usec () + 1); - normalize (); - return *this; + ACE_Time_Value tv (*this); + ++*this; + return tv; } ACE_Time_Value & ACE_Time_Value::operator ++ (void) { // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); - usec (usec () + 1); - normalize (); + this->usec (this->usec () + 1); + this->normalize (); return *this; } @@ -54,17 +55,17 @@ ACE_Time_Value ACE_Time_Value::operator -- (int) { // ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); - usec (usec () - 1); - normalize (); - return *this; + ACE_Time_Value tv (*this); + --*this; + return tv; } ACE_Time_Value & ACE_Time_Value::operator -- (void) { // ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); - usec (usec () - 1); - normalize (); + this->usec (this->usec () - 1); + this->normalize (); return *this; } @@ -164,7 +165,7 @@ void ACE_Time_Value::normalize (void) { // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); - // New code from Hans Rohnert... + // From Hans Rohnert... if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) { diff --git a/ace/Time_Value.h b/ace/Time_Value.h index 0110211576c..29fb9a76c48 100644 --- a/ace/Time_Value.h +++ b/ace/Time_Value.h @@ -152,9 +152,22 @@ public: # endif /* ACE_WIN32 */ /// Converts from ACE_Time_Value format into milli-seconds format. + /** + * @return Sum of second field (in milliseconds) and microsecond field + * (in milliseconds). + * + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ long msec (void) const; /// Converts from milli-seconds format into ACE_Time_Value format. + /** + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ void msec (long); /// Returns the value of the object as a timespec_t. @@ -174,12 +187,24 @@ public: // = The following are accessor/mutator methods. /// Get seconds. + /** + * @return The second field/component of this ACE_Time_Value. + * + * @note The semantics of this method differs from the msec() + * method. + */ long sec (void) const; /// Set seconds. void sec (long sec); /// Get microseconds. + /** + * @return The microsecond field/component of this ACE_Time_Value. + * + * @note The semantics of this method differs from the msec() + * method. + */ long usec (void) const; /// Set microseconds. @@ -196,29 +221,29 @@ public: /// Multiply the time value by the @a d factor, which must be >= 0. ACE_Time_Value &operator *= (double d); + /// Increment microseconds as postfix. /** - * Increment microseconds as postfix. * @note The only reason this is here is to allow the use of ACE_Atomic_Op * with ACE_Time_Value. */ ACE_Time_Value operator++ (int); + /// Increment microseconds as prefix. /** - * Increment microseconds as prefix. * @note The only reason this is here is to allow the use of ACE_Atomic_Op * with ACE_Time_Value. */ ACE_Time_Value &operator++ (void); + /// Decrement microseconds as postfix. /** - * Decrement microseconds as postfix. * @note The only reason this is here is to allow the use of ACE_Atomic_Op * with ACE_Time_Value. */ ACE_Time_Value operator-- (int); + /// Decrement microseconds as prefix. /** - * Decrement microseconds as prefix. * @note The only reason this is here is to allow the use of ACE_Atomic_Op * with ACE_Time_Value. */ |