TimeVal class is used for storing time value. Similar to "struct timeval", the time value is in seconds and microseconds.
static const int32_t ONE_MILLION | ONE_MILLION |
static const int32_t ONE_THOUSAND | ONE_THOUSAND |
static const int64_t UNIX_WIN32_EPOCH_DIFF | UNIX_WIN32_EPOCH_DIFF |
static const int32_t UNITS_100NS_PER_1US | UNITS_100NS_PER_1US |
TimeVal ()
| TimeVal |
TimeVal (int32_t sec, int32_t usec)
| TimeVal |
Constructor for given seconds and microseconds.
Parameters:
sec | the number of seconds. |
usec | the number of microseconds. |
explicit TimeVal (const timeval& timeval)
| TimeVal |
Constructor for given "struct timeval".
Parameters:
timeval | the "struct timeval" time value to initialize this object with. |
explicit TimeVal (const timespec& timespec)
| TimeVal |
Constructor for given POSIX "struct timespec".
Parameters:
timespec | the "struct timespec" time value to initialize this object with. |
explicit TimeVal (const FILETIME& ft)
| TimeVal |
Constructor for given "FILETIME".
Parameters:
ft | the "FILETIME" time value to initialize this object with. |
explicit TimeVal (const double& d)
| TimeVal |
Constructor for given double-float time value.
Parameters:
d | the double-float time value to initialize this object with. |
int32_t sec ()
| sec |
[const]
Get the number of seconds.
Returns: the number of seconds.
int32_t usec ()
| usec |
[const]
Get the number of microseconds.
Returns: the number of microseconds.
string str ()
| str |
[const]
Returns: seconds and microseconds as a string.
string pretty_print ()
| pretty_print |
[const]
Pretty print the time
Returns: the time as formated by ctime(3) without the newline.
TimeVal ZERO ()
| ZERO |
[static]
TimeVal MAXIMUM ()
| MAXIMUM |
[static]
Get the maximum permitted value.
TimeVal MINIMUM ()
| MINIMUM |
[static]
Get the minimum permitted value.
size_t copy_in (const timeval& timeval)
| copy_in |
Copy the time value from a timeval structure.
Parameters:
timeval | the storage to copy the time from. |
Returns: the number of copied octets.
size_t copy_out (timeval& timeval)
| copy_out |
[const]
Copy the time value to a timeval structure.
Parameters:
timeval | the storage to copy the time to. |
Returns: the number of copied octets.
size_t copy_in (const timespec& timespec)
| copy_in |
Copy the time value from a POSIX timespec structure.
Parameters:
timespec | the storage to copy the time from. |
Returns: the number of copied octets.
size_t copy_out (timespec& timespec)
| copy_out |
[const]
Copy the time value to a POSIX timespec structure.
Parameters:
timespec | the storage to copy the time to. |
Returns: the number of copied octets.
int32_t to_ms ()
| to_ms |
[const]
Return an int32_t containing the total number of milliseconds in the underlying structure. This is intended for convenience when working with Win32 APIs. XXX: This may overflow if _sec is too big.
Returns: the number of milliseconds in total.
size_t copy_in (const FILETIME& filetime)
| copy_in |
Copy the time value from a FILETIME structure.
Parameters:
filetime | the storage to copy the time from. |
Returns: the number of copied octets.
size_t copy_out (FILETIME& filetime)
| copy_out |
[const]
Copy the time value to a FILETIME structure.
Parameters:
filetime | the storage to copy the time to. |
Returns: the number of copied octets.
double get_double ()
| get_double |
[const]
Convert a TimeVal value to a double-float value.
Returns: the double-float value of this TimeVal time.
TimeVal& operator= (const TimeVal& other)
| operator= |
bool operator== (const TimeVal& other)
| operator== |
[const]
Equality Operator
Parameters:
other | the right-hand operand to compare against. |
Returns: true if the left-hand operand is numerically same as the right-hand operand.
bool operator< (const TimeVal& other)
| operator< |
[const]
Less-Than Operator
Parameters:
other | the right-hand operand to compare against. |
Returns: true if the left-hand operand is numerically smaller than the right-hand operand.
const TimeVal& operator+= (const TimeVal& delta)
| operator+= |
Assign-Sum Operator
Parameters:
delta | the TimeVal value to add to this TimeVal object. |
Returns: the TimeVal value after the addition of delta.
TimeVal operator+ (const TimeVal& other)
| operator+ |
[const]
Addition Operator
Parameters:
other | the TimeVal value to add to the value of this TimeVal object. |
Returns: the TimeVal value after the addition of other.
const TimeVal& operator-= (const TimeVal& delta)
| operator-= |
Assign-Difference Operator
Parameters:
delta | the TimeVal value to substract from this TimeVal object. |
Returns: the TimeVal value after the substraction of delta.
TimeVal operator- (const TimeVal& other)
| operator- |
[const]
Substraction Operator
Parameters:
other | the TimeVal value to substract from the value of this TimeVal object. |
Returns: the TimeVal value after the substraction of other.
TimeVal operator* (int n)
| operator* |
[const]
Multiplication Operator for integer operand
Parameters:
n | the integer value used in multiplying the value of this object with. |
Returns: the TimeVal value of multiplying the value of this object by n.
TimeVal operator* (unsigned int n)
| operator* |
[const]
Multiplication Operator for unsigned integer operand
Parameters:
n | the unsigned integer value used in multiplying the value of this object with. |
Returns: the TimeVal value of multiplying the value of this object by n.
TimeVal operator* (const double& d)
| operator* |
[const]
Multiplication Operator for double float operand
Parameters:
d | the double float value used in multiplying the value of this object with. |
Returns: the TimeVal value of multiplying the value of this object by d.
TimeVal operator/ (int n)
| operator/ |
[const]
Division Operator for integer operand
Parameters:
n | the integer value used in dividing the value of this object with. |
Returns: the TimeVal value of dividing the value of this object by n.
TimeVal operator/ (unsigned int n)
| operator/ |
[const]
Division Operator for unsigned integer operand
Parameters:
n | the unsigned integer value used in dividing the value of this object with. |
Returns: the TimeVal value of dividing the value of this object by n.
TimeVal operator/ (const double& d)
| operator/ |
[const]
Division Operator for double-float operand
Parameters:
d | the double-float value used in dividing the value of this object with. |
Returns: the TimeVal value of dividing the value of this object by d.
bool is_zero ()
| is_zero |
[const]
Test if this time value is numerically zero.
Returns: true if the address is numerically zero.