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 |
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 inline 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.
int32_t secs ()
| secs |
[const]
Get the number of seconds.
Returns: the number of seconds.
int32_t usecs ()
| usecs |
[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.
inline TimeVal ZERO ()
| ZERO |
[static]
inline TimeVal MAXIMUM ()
| MAXIMUM |
[static]
Get the maximum permitted value.
inline TimeVal MINIMUM ()
| MINIMUM |
[static]
Get the minimum permitted value.
inline 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.
inline 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.
double get_double ()
| get_double |
[const]
Convert a TimeVal value to a double-float value.
Returns: the double-float value of this TimeVal time.
inline TimeVal& operator= (const TimeVal& other)
| operator= |
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.
inline 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.