class TimeVal

TimeVal class. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods

Public Static Methods

Public Members


Detailed Description

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 int64_t UNIX_WIN32_EPOCH_DIFF

UNIX_WIN32_EPOCH_DIFF

static const int32_t UNITS_100NS_PER_1US

UNITS_100NS_PER_1US

 TimeVal ()

TimeVal

Default constructor

 TimeVal (int32_t sec, int32_t usec)

TimeVal

Constructor for given seconds and microseconds.

Parameters:

secthe number of seconds.
usecthe number of microseconds.
explicit  TimeVal (const timeval& timeval)

TimeVal

Constructor for given "struct timeval".

Parameters:

timevalthe "struct timeval" time value to initialize this object with.
explicit  TimeVal (const FILETIME& ft)

TimeVal

Constructor for given "FILETIME".

Parameters:

ftthe "FILETIME" time value to initialize this object with.
explicit inline  TimeVal (const double& d)

TimeVal

Constructor for given double-float time value.

Parameters:

dthe 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]

Get zero value.

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:

timevalthe 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:

timevalthe storage to copy the time to.

Returns: the number of copied octets.

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

inline size_t  copy_in (const FILETIME& filetime)

copy_in

Copy the time value from a FILETIME structure.

Parameters:

filetimethe storage to copy the time from.

Returns: the number of copied octets.

inline size_t  copy_out (FILETIME& filetime)

copy_out

[const]

Copy the time value to a FILETIME structure.

Parameters:

filetimethe 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=

Assignment Operator

inline bool  operator== (const TimeVal& other)

operator==

[const]

Equality Operator

Parameters:

otherthe 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:

otherthe 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:

deltathe 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:

otherthe 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:

deltathe 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:

otherthe 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:

nthe 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:

dthe 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:

nthe 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:

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


Generated by: pavlin on possum.icir.org on Thu Mar 9 04:41:55 2006, using kdoc $.