class TimeVal

TimeVal class. More...

Definition#include <timeval.hh>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

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

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

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.

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 Nov 6 23:46:46 2003, using kdoc 2.0a54+XORP.