#include <Time_Value.h>
Collaboration diagram for ACE_Time_Value:
Public Member Functions | |
ACE_Time_Value (void) | |
Default Constructor. | |
ACE_Time_Value (time_t sec, suseconds_t usec=0) | |
Constructor. | |
ACE_Time_Value (const struct timeval &t) | |
Construct the ACE_Time_Value from a timeval. | |
ACE_Time_Value (const timespec_t &t) | |
Construct the ACE_Time_Value object from a timespec_t. | |
void | set (time_t sec, suseconds_t usec) |
Initializes the ACE_Time_Value from seconds and useconds. | |
void | set (double d) |
void | set (const timeval &t) |
Initializes the ACE_Time_Value from a timeval. | |
void | set (const timespec_t &t) |
Initializes the ACE_Time_Value object from a timespec_t. | |
unsigned long | msec (void) const |
Converts from ACE_Time_Value format into milli-seconds format. | |
void | msec (ACE_UINT64 &ms) const |
void | msec (long) |
Converts from milli-seconds format into ACE_Time_Value format. | |
operator timespec_t () const | |
Returns the value of the object as a timespec_t. | |
operator timeval () const | |
Returns the value of the object as a timeval. | |
operator const timeval * () const | |
Returns a pointer to the object as a timeval. | |
time_t | sec (void) const |
Get seconds. | |
void | sec (time_t sec) |
Set seconds. | |
suseconds_t | usec (void) const |
Get microseconds. | |
void | usec (suseconds_t usec) |
Set microseconds. | |
void | to_usec (ACE_UINT64 &usec) const |
ACE_Time_Value & | operator+= (const ACE_Time_Value &tv) |
Add tv to this. | |
ACE_Time_Value & | operator+= (time_t tv) |
Add tv to this. | |
ACE_Time_Value & | operator= (const ACE_Time_Value &tv) |
Assign @ tv to this. | |
ACE_Time_Value & | operator= (time_t tv) |
Assign @ tv to this. | |
ACE_Time_Value & | operator-= (const ACE_Time_Value &tv) |
Subtract tv to this. | |
ACE_Time_Value & | operator-= (time_t tv) |
Substract tv to this. | |
ACE_Time_Value & | operator *= (double d) |
Multiply the time value by the d factor. | |
ACE_Time_Value | operator++ (int) |
Increment microseconds as postfix. | |
ACE_Time_Value & | operator++ (void) |
Increment microseconds as prefix. | |
ACE_Time_Value | operator-- (int) |
Decrement microseconds as postfix. | |
ACE_Time_Value & | operator-- (void) |
Decrement microseconds as prefix. | |
void | dump (void) const |
Dump is a no-op. | |
Static Public Attributes | |
static const ACE_Time_Value | zero |
Constant "0". | |
static const ACE_Time_Value | max_time |
Private Member Functions | |
void | normalize (void) |
Put the timevalue into a canonical form. | |
Private Attributes | |
timeval | tv_ |
Store the values as a timeval. | |
Friends | |
ACE_Export ACE_Time_Value | operator+ (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
Adds two ACE_Time_Value objects together, returns the sum. | |
ACE_Export ACE_Time_Value | operator- (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
Subtracts two ACE_Time_Value objects, returns the difference. | |
ACE_Export bool | operator< (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 < tv2. | |
ACE_Export bool | operator> (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 > tv2. | |
ACE_Export bool | operator<= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 <= tv2. | |
ACE_Export bool | operator>= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 >= tv2. | |
ACE_Export bool | operator== (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 == tv2. | |
ACE_Export bool | operator!= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) |
True if tv1 != tv2. | |
ACE_Export ACE_Time_Value | operator * (double d, const ACE_Time_Value &tv) |
Multiplies the time value by d. | |
ACE_Export ACE_Time_Value | operator * (const ACE_Time_Value &tv, double d) |
Multiplies the time value by d. |
This class centralizes all the time related processing in ACE. These time values are typically used in conjunction with OS mechanisms like <select>, <poll>, or <cond_timedwait>.
Definition at line 66 of file Time_Value.h.
ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | void | ) |
Default Constructor.
Definition at line 108 of file Time_Value.inl.
References set().
00109 : tv_ () 00110 { 00111 // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); 00112 this->set (0, 0); 00113 }
ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | time_t | sec, | |
suseconds_t | usec = 0 | |||
) | [explicit] |
ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | const struct timeval & | t | ) | [explicit] |
Construct the ACE_Time_Value from a timeval.
Definition at line 47 of file Time_Value.inl.
References set().
00048 : tv_ () 00049 { 00050 // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); 00051 this->set (tv); 00052 }
ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | const timespec_t & | t | ) | [explicit] |
Construct the ACE_Time_Value object from a timespec_t.
Definition at line 271 of file Time_Value.inl.
References set().
00272 : tv_ () 00273 { 00274 // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); 00275 this->set (tv); 00276 }
void ACE_Time_Value::dump | ( | void | ) | const |
Dump is a no-op.
The dump() method is a no-op. It's here for backwards compatibility only, but does not dump anything. Invoking logging methods here violates layering restrictions in ACE because this class is part of the OS layer and ACE_Log_Msg
is at a higher level.
Definition at line 156 of file Time_Value.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, and LM_DEBUG.
Referenced by ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::dump(), and ACE_Timer_Node_T< TYPE >::dump().
00157 { 00158 #if defined (ACE_HAS_DUMP) 00159 // ACE_OS_TRACE ("ACE_Time_Value::dump"); 00160 #if 0 00161 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00162 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntv_sec_ = %d"), this->tv_.tv_sec)); 00163 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntv_usec_ = %d\n"), this->tv_.tv_usec)); 00164 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00165 #endif /* 0 */ 00166 #endif /* ACE_HAS_DUMP */ 00167 }
ACE_INLINE void ACE_Time_Value::msec | ( | long | ) |
Converts from milli-seconds format into ACE_Time_Value format.
Definition at line 166 of file Time_Value.inl.
References tv_.
00167 { 00168 // ACE_OS_TRACE ("ACE_Time_Value::msec"); 00169 // Convert millisecond units to seconds; 00170 long secs = milliseconds / 1000; 00171 this->tv_.tv_sec = secs; 00172 // Convert remainder to microseconds; 00173 this->tv_.tv_usec = (milliseconds - (secs * 1000)) * 1000; 00174 }
ACE_INLINE void ACE_Time_Value::msec | ( | ACE_UINT64 & | ms | ) | const |
ms | parameter. |
Definition at line 155 of file Time_Value.inl.
References tv_.
00156 { 00157 // ACE_OS_TRACE ("ACE_Time_Value::msec"); 00158 ms = ACE_Utils::truncate_cast<ACE_UINT64> (this->tv_.tv_sec); 00159 ms *= 1000; 00160 ms += (this->tv_.tv_usec / 1000); 00161 }
ACE_INLINE unsigned long ACE_Time_Value::msec | ( | void | ) | const |
Converts from ACE_Time_Value format into milli-seconds format.
Definition at line 143 of file Time_Value.inl.
References tv_.
Referenced by ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::calculate_spoke(), ACE_High_Res_Timer::calibrate(), ACE_SPIPE_Connector::connect(), ACE_OS::event_timedwait(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::expire(), ACE_OS::mutex_lock(), ACE_OS::poll(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::reschedule(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::schedule_i(), ACE_OS::sema_wait(), ACE_OS::sleep(), ACE_Process_Manager::wait(), and ACE_Process::wait().
00144 { 00145 // ACE_OS_TRACE ("ACE_Time_Value::msec"); 00146 00147 // Note - we're truncating a value here, which can lose data. This is 00148 // called out in the user documentation for this with a recommendation to 00149 // use msec(ACE_UINT64&) instead, so just go ahead and truncate. 00150 time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; 00151 return ACE_Utils::truncate_cast<unsigned long> (secs); 00152 }
void ACE_Time_Value::normalize | ( | void | ) | [private] |
Put the timevalue into a canonical form.
Definition at line 170 of file Time_Value.cpp.
References ACE_ONE_SECOND_IN_USECS, and tv_.
Referenced by operator++(), operator+=(), operator--(), operator-=(), and set().
00171 { 00172 // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); 00173 // From Hans Rohnert... 00174 00175 if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) 00176 { 00177 /*! \todo This loop needs some optimization. 00178 */ 00179 do 00180 { 00181 ++this->tv_.tv_sec; 00182 this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; 00183 } 00184 while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); 00185 } 00186 else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) 00187 { 00188 /*! \todo This loop needs some optimization. 00189 */ 00190 do 00191 { 00192 --this->tv_.tv_sec; 00193 this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; 00194 } 00195 while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); 00196 } 00197 00198 if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) 00199 { 00200 --this->tv_.tv_sec; 00201 this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; 00202 } 00203 // tv_sec in qnxnto is unsigned 00204 #if !defined ( __QNXNTO__) 00205 else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) 00206 { 00207 ++this->tv_.tv_sec; 00208 this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; 00209 } 00210 #endif /* __QNXNTO__ */ 00211 }
ACE_Time_Value & ACE_Time_Value::operator *= | ( | double | d | ) |
Multiply the time value by the d factor.
Definition at line 215 of file Time_Value.cpp.
References ACE_ONE_SECOND_IN_USECS, ACE_Numeric_Limits< T >::max(), ACE_Numeric_Limits< T >::min(), sec(), set(), and usec().
00216 { 00217 // The floating type to be used in the computations. It should be 00218 // large enough to hold a time_t. We actually want a floating type 00219 // with enough digits in its mantissa to hold a time_t without 00220 // losing precision. For example, if FLT_RADIX is 2 and 00221 // LDBL_MANT_DIG is 64, a long double has a 64 bit wide mantissa, 00222 // which would be sufficient to hold a 64 bit time_t value without 00223 // losing precision. 00224 // 00225 // For now we'll simply go with long double if it is larger than 00226 // time_t. We're hosed if long double isn't large enough. 00227 typedef ACE::If_Then_Else<(sizeof (double) > sizeof (time_t)), 00228 double, 00229 long double>::result_type float_type; 00230 00231 float_type time_total = 00232 (this->sec () 00233 + static_cast<float_type> (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d; 00234 00235 // shall we saturate the result? 00236 static const float_type max_int = 00237 ACE_Numeric_Limits<time_t>::max () + 0.999999; 00238 static const float_type min_int = 00239 ACE_Numeric_Limits<time_t>::min () - 0.999999; 00240 00241 if (time_total > max_int) 00242 time_total = max_int; 00243 if (time_total < min_int) 00244 time_total = min_int; 00245 00246 const time_t time_sec = static_cast<time_t> (time_total); 00247 00248 time_total -= time_sec; 00249 time_total *= ACE_ONE_SECOND_IN_USECS; 00250 00251 suseconds_t time_usec = static_cast<suseconds_t> (time_total); 00252 00253 // round up the result to save the last usec 00254 if (time_usec > 0 && (time_total - time_usec) >= 0.5) 00255 ++time_usec; 00256 else if (time_usec < 0 && (time_total - time_usec) <= -0.5) 00257 --time_usec; 00258 00259 this->set (time_sec, time_usec); 00260 00261 return *this; 00262 }
ACE_INLINE ACE_Time_Value::operator const timeval * | ( | ) | const |
Returns a pointer to the object as a timeval.
Definition at line 55 of file Time_Value.inl.
References tv_.
00056 { 00057 // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); 00058 #if defined (ACE_HAS_TIME_T_LONG_MISMATCH) 00059 // Recall that on some Windows we substitute another type for timeval in tv_ 00060 ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this); 00061 me->ext_tv_.tv_sec = ACE_Utils::truncate_cast<long> (this->tv_.tv_sec); 00062 me->ext_tv_.tv_usec = ACE_Utils::truncate_cast<long> (this->tv_.tv_usec); 00063 return (const timeval *) &this->ext_tv_; 00064 #else 00065 return (const timeval *) &this->tv_; 00066 #endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ 00067 }
ACE_INLINE ACE_Time_Value::operator timespec_t | ( | ) | const |
Returns the value of the object as a timespec_t.
Definition at line 258 of file Time_Value.inl.
References sec(), tv_, timespec::tv_nsec, and timespec::tv_sec.
00259 { 00260 // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); 00261 timespec_t tv; 00262 tv.tv_sec = this->sec (); 00263 // Convert microseconds into nanoseconds. 00264 tv.tv_nsec = this->tv_.tv_usec * 1000; 00265 return tv; 00266 }
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Time_Value::operator timeval | ( | ) | const |
Returns the value of the object as a timeval.
Definition at line 22 of file Time_Value.inl.
References tv_.
00023 { 00024 // ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); 00025 #if defined (ACE_HAS_TIME_T_LONG_MISMATCH) 00026 // Recall that on some Windows we substitute another type for timeval in tv_ 00027 ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this); 00028 me->ext_tv_.tv_sec = ACE_Utils::truncate_cast<long> (this->tv_.tv_sec); 00029 me->ext_tv_.tv_usec = ACE_Utils::truncate_cast<long> (this->tv_.tv_usec); 00030 return this->ext_tv_; 00031 #else 00032 return this->tv_; 00033 #endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ 00034 }
ACE_Time_Value & ACE_Time_Value::operator++ | ( | void | ) |
Increment microseconds as prefix.
Definition at line 46 of file Time_Value.cpp.
References normalize(), and usec().
00047 { 00048 // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); 00049 this->usec (this->usec () + 1); 00050 this->normalize (); 00051 return *this; 00052 }
ACE_Time_Value ACE_Time_Value::operator++ | ( | int | ) |
Increment microseconds as postfix.
Definition at line 37 of file Time_Value.cpp.
00038 { 00039 // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); 00040 ACE_Time_Value tv (*this); 00041 ++*this; 00042 return tv; 00043 }
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator+= | ( | time_t | tv | ) |
Add tv to this.
Definition at line 332 of file Time_Value.inl.
References sec().
00333 { 00334 // ACE_OS_TRACE ("ACE_Time_Value::operator+="); 00335 this->sec (this->sec () + tv); 00336 return *this; 00337 }
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator+= | ( | const ACE_Time_Value & | tv | ) |
Add tv to this.
Definition at line 322 of file Time_Value.inl.
References normalize(), sec(), and usec().
00323 { 00324 // ACE_OS_TRACE ("ACE_Time_Value::operator+="); 00325 this->sec (this->sec () + tv.sec ()); 00326 this->usec (this->usec () + tv.usec ()); 00327 this->normalize (); 00328 return *this; 00329 }
ACE_Time_Value & ACE_Time_Value::operator-- | ( | void | ) |
Decrement microseconds as prefix.
Definition at line 67 of file Time_Value.cpp.
References normalize(), and usec().
00068 { 00069 // ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); 00070 this->usec (this->usec () - 1); 00071 this->normalize (); 00072 return *this; 00073 }
ACE_Time_Value ACE_Time_Value::operator-- | ( | int | ) |
Decrement microseconds as postfix.
Definition at line 58 of file Time_Value.cpp.
00059 { 00060 // ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); 00061 ACE_Time_Value tv (*this); 00062 --*this; 00063 return tv; 00064 }
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator-= | ( | time_t | tv | ) |
Substract tv to this.
Definition at line 370 of file Time_Value.inl.
References sec().
00371 { 00372 // ACE_OS_TRACE ("ACE_Time_Value::operator-="); 00373 this->sec (this->sec () - tv); 00374 return *this; 00375 }
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator-= | ( | const ACE_Time_Value & | tv | ) |
Subtract tv to this.
Definition at line 360 of file Time_Value.inl.
References normalize(), sec(), and usec().
00361 { 00362 // ACE_OS_TRACE ("ACE_Time_Value::operator-="); 00363 this->sec (this->sec () - tv.sec ()); 00364 this->usec (this->usec () - tv.usec ()); 00365 this->normalize (); 00366 return *this; 00367 }
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator= | ( | time_t | tv | ) |
ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator= | ( | const ACE_Time_Value & | tv | ) |
ACE_INLINE void ACE_Time_Value::sec | ( | time_t | sec | ) |
ACE_INLINE time_t ACE_Time_Value::sec | ( | void | ) | const |
Get seconds.
Definition at line 125 of file Time_Value.inl.
References tv_.
Referenced by ACE_Name_Request::ACE_Name_Request(), ACE_Log_Record::decode(), ACE_Name_Request::dump(), ACE_Dynamic_Message_Strategy::dump(), ACE_OS::event_timedwait(), ACE_System_Time::get_master_system_time(), ACE_OS::gethrtime(), ACE_High_Res_Timer::gettime(), ACE::handle_timed_accept(), ACE_High_Res_Timer::hrtime_to_tv(), ACE_OS::mktime(), ACE_OS::mutex_lock(), operator *=(), operator timespec_t(), operator+=(), operator-=(), operator<<(), operator=(), operator==(), operator>(), operator>=(), ACE_Dynamic_Message_Strategy::priority_status(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::reschedule(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::schedule_i(), ACE_OS::sema_wait(), ACE_SOCK_SEQPACK_Connector::shared_connect_finish(), ACE_SOCK_Connector::shared_connect_finish(), ACE_OS::time(), ACE_Log_Record::time_stamp(), ACE_Name_Request::timeout(), ACE::timestamp(), ACE_OS::ualarm(), and ACE_Date_Time::update().
00126 { 00127 // ACE_OS_TRACE ("ACE_Time_Value::sec"); 00128 return this->tv_.tv_sec; 00129 }
ACE_INLINE void ACE_Time_Value::set | ( | const timespec_t & | t | ) |
Initializes the ACE_Time_Value object from a timespec_t.
Definition at line 99 of file Time_Value.inl.
References set(), timespec::tv_nsec, and timespec::tv_sec.
00100 { 00101 // ACE_OS_TRACE ("ACE_Time_Value::set"); 00102 00103 this->set (tv.tv_sec, 00104 tv.tv_nsec / 1000); // Convert nanoseconds into microseconds. 00105 }
ACE_INLINE void ACE_Time_Value::set | ( | const timeval & | t | ) |
Initializes the ACE_Time_Value from a timeval.
Definition at line 37 of file Time_Value.inl.
References normalize(), and tv_.
00038 { 00039 // ACE_OS_TRACE ("ACE_Time_Value::set"); 00040 this->tv_.tv_sec = tv.tv_sec; 00041 this->tv_.tv_usec = tv.tv_usec; 00042 00043 this->normalize (); 00044 }
ACE_INLINE void ACE_Time_Value::set | ( | double | d | ) |
Initializes the ACE_Time_Value from a double, which is assumed to be in second format, with any remainder treated as microseconds.
Definition at line 85 of file Time_Value.inl.
References ACE_ONE_SECOND_IN_USECS, normalize(), and tv_.
00086 { 00087 // ACE_OS_TRACE ("ACE_Time_Value::set"); 00088 long l = (long) d; 00089 this->tv_.tv_sec = l; 00090 this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); 00091 this->normalize (); 00092 }
ACE_INLINE void ACE_Time_Value::set | ( | time_t | sec, | |
suseconds_t | usec | |||
) |
Initializes the ACE_Time_Value from seconds and useconds.
Definition at line 70 of file Time_Value.inl.
References ACE_ONE_SECOND_IN_USECS, normalize(), and tv_.
Referenced by ACE_Time_Value(), ACE_OS::cond_timedwait(), ACE_System_Time::get_local_system_time(), operator *=(), and set().
00071 { 00072 // ACE_OS_TRACE ("ACE_Time_Value::set"); 00073 this->tv_.tv_sec = sec; 00074 this->tv_.tv_usec = usec; 00075 #if __GNUC__ 00076 if (__builtin_constant_p(sec) && 00077 __builtin_constant_p(usec) && 00078 (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) 00079 return; 00080 #endif 00081 this->normalize (); 00082 }
ACE_INLINE void ACE_Time_Value::to_usec | ( | ACE_UINT64 & | usec | ) | const |
usec | parameter. |
Definition at line 195 of file Time_Value.inl.
References tv_.
Referenced by ACE_Utils::UUID_Generator::get_systemtime().
00196 { 00197 // ACE_OS_TRACE ("ACE_Time_Value::to_usec"); 00198 00199 #if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) 00200 usec = ACE_U_LongLong (static_cast<long long> (this->tv_.tv_sec)); 00201 #elif defined (ACE_LACKS_LONGLONG_T) 00202 // No native 64-bit type, meaning time_t is most likely 32 bits. 00203 usec = ACE_U_LongLong (this->tv_.tv_sec); 00204 #else 00205 usec = static_cast<ACE_UINT64> (this->tv_.tv_sec); 00206 #endif /* ACE_LACKS_LONG_LONG_T */ 00207 usec *= 1000000; 00208 usec += this->tv_.tv_usec; 00209 }
ACE_INLINE void ACE_Time_Value::usec | ( | suseconds_t | usec | ) |
ACE_INLINE suseconds_t ACE_Time_Value::usec | ( | void | ) | const |
Get microseconds.
Definition at line 179 of file Time_Value.inl.
References tv_.
Referenced by ACE_Name_Request::ACE_Name_Request(), ACE_Log_Record::decode(), ACE_Buffered_Svc_Handler<, >::dump(), ACE_Name_Request::dump(), ACE_Dynamic_Message_Strategy::dump(), ACE_OS::event_timedwait(), ACE_OS::gethrtime(), ACE_High_Res_Timer::gettime(), ACE::handle_timed_accept(), ACE_High_Res_Timer::hrtime_to_tv(), ACE_OS::mutex_lock(), operator *=(), operator++(), operator+=(), operator--(), operator-=(), operator<<(), operator=(), operator==(), operator>(), operator>=(), ACE_Dynamic_Message_Strategy::priority_status(), ACE_OS::sema_wait(), ACE_SOCK_SEQPACK_Connector::shared_connect_finish(), ACE_SOCK_Connector::shared_connect_finish(), ACE_Log_Record::time_stamp(), ACE_Name_Request::timeout(), ACE::timestamp(), ACE_OS::ualarm(), and ACE_Date_Time::update().
00180 { 00181 // ACE_OS_TRACE ("ACE_Time_Value::usec"); 00182 return this->tv_.tv_usec; 00183 }
ACE_Export ACE_Time_Value operator * | ( | const ACE_Time_Value & | tv, | |
double | d | |||
) | [friend] |
Multiplies the time value by d.
Definition at line 218 of file Time_Value.inl.
00219 { 00220 return ACE_Time_Value (tv) *= d; 00221 }
ACE_Export ACE_Time_Value operator * | ( | double | d, | |
const ACE_Time_Value & | tv | |||
) | [friend] |
Multiplies the time value by d.
Definition at line 212 of file Time_Value.inl.
00213 { 00214 return ACE_Time_Value (tv) *= d; 00215 }
ACE_Export bool operator!= | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
ACE_Export ACE_Time_Value operator+ | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
Adds two ACE_Time_Value objects together, returns the sum.
Definition at line 380 of file Time_Value.inl.
00382 { 00383 // ACE_OS_TRACE ("operator +"); 00384 ACE_Time_Value sum (tv1); 00385 sum += tv2; 00386 00387 return sum; 00388 }
ACE_Export ACE_Time_Value operator- | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
Subtracts two ACE_Time_Value objects, returns the difference.
Definition at line 393 of file Time_Value.inl.
00395 { 00396 // ACE_OS_TRACE ("operator -"); 00397 ACE_Time_Value delta (tv1); 00398 delta -= tv2; 00399 00400 return delta; 00401 }
ACE_Export bool operator< | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
ACE_Export bool operator<= | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
ACE_Export bool operator== | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
ACE_Export bool operator> | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
ACE_Export bool operator>= | ( | const ACE_Time_Value & | tv1, | |
const ACE_Time_Value & | tv2 | |||
) | [friend] |
const ACE_Time_Value ACE_Time_Value::max_time [static] |
Constant for maximum time representable. Note that this time is not intended for use with <select> or other calls that may have *their own* implementation-specific maximum time representations. Its primary use is in time computations such as those used by the dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class.
Definition at line 81 of file Time_Value.h.
Referenced by ACE_Message_Block::ACE_Message_Block(), ACE_Message_Queue< ACE_SYNCH_USE >::dequeue_deadline_i(), ACE_Activation_Queue::enqueue(), ACE_OutputCDR::grow_and_adjust(), ACE_Message_Block::init(), ACE_Message_Block::msg_deadline_time(), ACE_Process_Manager::reap(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::remove_first(), ACE_Process_Manager::wait(), and ACE_Process::wait().
timeval ACE_Time_Value::tv_ [private] |
Store the values as a timeval.
Definition at line 334 of file Time_Value.h.
Referenced by msec(), normalize(), operator const timeval *(), operator timespec_t(), operator timeval(), sec(), set(), to_usec(), and usec().
ACE_BEGIN_VERSIONED_NAMESPACE_DECL const ACE_Time_Value ACE_Time_Value::zero [static] |
Constant "0".
Definition at line 71 of file Time_Value.h.
Referenced by ACE_Oneshot_Acceptor< SVC_HANDLER, >::accept(), ACE_Message_Block::ACE_Message_Block(), ACE::Monitor_Control::Monitor_Admin::auto_query(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::calculate_timeout(), ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::check_handles(), ACE::Monitor_Control::Monitor_Base::clear_i(), ACE_SPIPE_Connector::connect(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::connect_i(), ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::dispatch_info_i(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_time(), ACE_Timer_List_T< TYPE, FUNCTOR, ACE_LOCK >::earliest_time(), ACE_Activation_Queue::enqueue(), ACE_OS::event_timedwait(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::expire(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::expire(), ACE_Timer_Hash_T< TYPE, FUNCTOR, ACE_LOCK, BUCKET >::find_new_earliest(), ACE_Timer_Node_T< TYPE >::get_dispatch_info(), ACE_OutputCDR::grow_and_adjust(), ACE_Process_Manager::handle_input(), ACE_Message_Block::init(), ACE::Monitor_Control::Monitor_Admin::monitor_point(), ACE_Message_Block::msg_execution_time(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::open_i(), ACE_Dynamic_Message_Strategy::priority_status(), ACE_Process_Manager::reap(), ACE_Timer_Wheel_T< TYPE, FUNCTOR, ACE_LOCK >::recalc_earliest(), ACE_OS::sched_params(), ACE_Async_Timer_Queue_Adapter< TQ >::schedule_ualarm(), ACE_OS::sema_wait(), ACE_Synch_Options::set(), ACE_OS::set_scheduling_params(), ACE_Countdown_Time::stop(), ACE_Process_Manager::wait(), ACE_Process::wait(), and ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::wakeup_all_threads().