Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Time_Value Class Reference

Operations on "timeval" structures, which express time in seconds (secs) and microseconds (usecs). More...

`#include <Time_Value.h>`

Collaboration diagram for ACE_Time_Value:

[legend]
List of all members.

## Public Methods
| ACE_Time_Value (void)
| Default Constructor. More...
| ACE_Time_Value (long sec, long usec=0)
| Constructor. More...
| ACE_Time_Value (const struct timeval &t)
| Construct the ACE_Time_Value from a timeval. More...
| ACE_Time_Value (const timespec_t &t)
| Construct the ACE_Time_Value object from a timespec_t. More...
| ACE_Time_Value (const FILETIME &ft)
| Construct the ACE_Time_Value object from a Win32 FILETIME. More...
void | set (long sec, long usec)
| Initializes the ACE_Time_Value from two longs. More...
void | 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. More...
void | set (const timeval &t)
| Initializes the ACE_Time_Value from a timeval. More...
void | set (const timespec_t &t)
| Initializes the ACE_Time_Value object from a timespec_t. More...
void | set (const FILETIME &ft)
| Initializes the ACE_Time_Value object from a Win32 FILETIME. More...
long | msec (void) const
void | msec (long)
| operator timespec_t () const
| Returns the value of the object as a timespec_t. More...
| operator timeval () const
| Returns the value of the object as a timeval. More...
| operator const timeval * () const
| Returns a pointer to the object as a timeval. More...
| operator FILETIME () const
| Returns the value of the object as a Win32 FILETIME. More...
long | sec (void) const
void | sec (long sec)
| Set seconds. More...
long | usec (void) const
void | usec (long usec)
| Set microseconds. More...
ACE_Time_Value & | operator+= (const ACE_Time_Value &tv)
| Add tv to this. More...
ACE_Time_Value & | operator-= (const ACE_Time_Value &tv)
| Subtract tv to this. More...
ACE_Time_Value & | operator *= (double d)
| Multiply the time value by the d factor, which must be >= 0. More...
ACE_Time_Value | operator++ (int)
ACE_Time_Value & | operator++ (void)
ACE_Time_Value | operator-- (int)
ACE_Time_Value & | operator-- (void)
void | dump (void) const
| The dump() method is a no-op. More...
## Static Public Attributes
const ACE_Time_Value | zero
| Constant "0". More...
const ACE_Time_Value | max_time
| Constant for maximum time representable. More...
const DWORDLONG | FILETIME_to_timval_skew
| Const time difference between FILETIME and POSIX time. More...
## Private Methods
void | normalize (void)
| Put the timevalue into a canonical form. More...
## Private Attributes
timeval | tv_
| Store the values as a timeval. More...
## Friends
ACE_OS_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. More...
ACE_OS_Export ACE_Time_Value | operator- (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| Subtracts two ACE_Time_Value objects, returns the difference. More...
ACE_OS_Export int | operator< (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 < tv2. More...
ACE_OS_Export int | operator> (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 > tv2. More...
ACE_OS_Export int | operator<= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 <= tv2. More...
ACE_OS_Export int | operator>= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 >= tv2. More...
ACE_OS_Export int | operator== (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 == tv2. More...
ACE_OS_Export int | operator!= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2)
| True if tv1 != tv2. More...
ACE_OS_Export ACE_Time_Value | operator * (double d, const ACE_Time_Value &tv)
| Multiplies the time value by d. More...
ACE_OS_Export ACE_Time_Value | operator * (const ACE_Time_Value &tv, double d)
| Multiplies the time value by d. More...

## Detailed Description

Operations on "timeval" structures, which express time in seconds (secs) and microseconds (usecs).

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>.

## Constructor & Destructor Documentation

ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | void |  | ) |

| Default Constructor.

ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | long | sec,
|  | long | usec = 0
| ) |

| Constructor.

ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | const struct timeval & | tv | ) |

| Construct the ACE_Time_Value from a timeval.

ACE_INLINE ACE_Time_Value::ACE_Time_Value | ( | const timespec_t & | tv | ) |

| Construct the ACE_Time_Value object from a timespec_t.

ACE_Time_Value::ACE_Time_Value | ( | const FILETIME & | file_time | ) |

| Construct the ACE_Time_Value object from a Win32 FILETIME.

## Member Function Documentation

void ACE_Time_Value::dump | ( | void |  | ) | const

| 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.

ACE_INLINE void ACE_Time_Value::msec | ( | long | 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.

ACE_INLINE long ACE_Time_Value::msec | ( | void |  | ) | const

| Returns: 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.

void ACE_Time_Value::normalize | ( | void |  | ) | `[private]`

| Put the timevalue into a canonical form.

ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator *= | ( | double | d | ) |

| Multiply the time value by the d factor, which must be >= 0.

ACE_INLINE ACE_Time_Value::operator const timeval * | ( |  | ) | const

| Returns a pointer to the object as a timeval.

ACE_Time_Value::operator FILETIME | ( |  | ) | const

| Returns the value of the object as a Win32 FILETIME.

ACE_INLINE ACE_Time_Value::operator timespec_t | ( |  | ) | const

| Returns the value of the object as a timespec_t.

ACE_INLINE ACE_Time_Value::operator timeval | ( |  | ) | const

| Returns the value of the object as a timeval.

ACE_Time_Value & ACE_Time_Value::operator++ | ( | void |  | ) |

| Note: The only reason this is here is to allow the use of ACE_Atomic_Op with ACE_Time_Value.

ACE_Time_Value ACE_Time_Value::operator++ | ( | int |  | ) |

| Note: The only reason this is here is to allow the use of ACE_Atomic_Op with ACE_Time_Value.

ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator+= | ( | const ACE_Time_Value & | tv | ) |

| Add tv to this.

ACE_Time_Value & ACE_Time_Value::operator-- | ( | void |  | ) |

| Note: The only reason this is here is to allow the use of ACE_Atomic_Op with ACE_Time_Value.

ACE_Time_Value ACE_Time_Value::operator-- | ( | int |  | ) |

| Note: The only reason this is here is to allow the use of ACE_Atomic_Op with ACE_Time_Value.

ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator-= | ( | const ACE_Time_Value & | tv | ) |

| Subtract tv to this.

ACE_INLINE void ACE_Time_Value::sec | ( | long | sec | ) |

| Set seconds.

ACE_INLINE long ACE_Time_Value::sec | ( | void |  | ) | const

| Returns: The second field/component of this ACE_Time_Value. Note: The semantics of this method differs from the msec() method.

void ACE_Time_Value::set | ( | const FILETIME & | file_time | ) |

| Initializes the ACE_Time_Value object from a Win32 FILETIME.

ACE_INLINE void ACE_Time_Value::set | ( | const timespec_t & | tv | ) |

| Initializes the ACE_Time_Value object from a timespec_t.

ACE_INLINE void ACE_Time_Value::set | ( | const timeval & | tv | ) |

| Initializes the ACE_Time_Value from a timeval.

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.

ACE_INLINE void ACE_Time_Value::set | ( | long | sec,
|  | long | usec
| ) |

| Initializes the ACE_Time_Value from two longs.

ACE_INLINE void ACE_Time_Value::usec | ( | long | usec | ) |

| Set microseconds.

ACE_INLINE long ACE_Time_Value::usec | ( | void |  | ) | const

| Returns: The microsecond field/component of this ACE_Time_Value. Note: The semantics of this method differs from the msec() method.

## Friends And Related Function Documentation

ACE_OS_Export ACE_Time_Value operator * | ( | const ACE_Time_Value & | tv,
|  | double | d
| ) | `[friend]`

| Multiplies the time value by d.

ACE_OS_Export ACE_Time_Value operator * | ( | double | d,
|  | const ACE_Time_Value & | tv
| ) | `[friend]`

| Multiplies the time value by d.

ACE_OS_Export int operator!= | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 != tv2.

ACE_OS_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.

ACE_OS_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.

ACE_OS_Export int operator< | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 < tv2.

ACE_OS_Export int operator<= | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 <= tv2.

ACE_OS_Export int operator== | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 == tv2.

ACE_OS_Export int operator> | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 > tv2.

ACE_OS_Export int operator>= | ( | const ACE_Time_Value & | tv1,
|  | const ACE_Time_Value & | tv2
| ) | `[friend]`

| True if tv1 >= tv2.

## Member Data Documentation

const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew`[static]`

| Initial value:
    ACE_INT64_LITERAL (0x19db1ded53e8000)
Const time difference between FILETIME and POSIX time.

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.

timeval ACE_Time_Value::tv_`[private]`

| Store the values as a timeval.

const ACE_Time_Value ACE_Time_Value::zero`[static]`

| Constant "0".

The documentation for this class was generated from the following files:

- Time_Value.h
- Time_Value.cpp
- Time_Value.inl