Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
postime_t Class Reference

Time with millisecond precision. More...

#include <postime.h>

+ Collaboration diagram for postime_t:

Public Member Functions

 postime_t ()
 postime_t constructor
 postime_t (int msecs)
 constructor with a number of milliseconds
int after (const postime_t &t)
 Number of milliseconds after t.
postime_t operator+ (const postime_t &t)
 time addition
postime_t operator+ (int t)
 time millisecond addition
postime_toperator+= (const postime_t &t)
 time addition
postime_toperator+= (int t)
 time millisecond addition
postime_t operator- (const postime_t &t)
 time substraction
bool operator< (const postime_t &t)
 less than
bool operator<= (const postime_t &t)
 less than or equal
postime_toperator= (const postime_t &t)
 time assignment
bool operator== (const postime_t &t)
 equality check
bool operator> (const postime_t &t)
 greater than
bool operator> (const timespec &t)
 greater than timespec
bool operator>= (const postime_t &t)
 greater than or equal

Public Attributes

long msec
 number of milliseconds
long sec
 number of seconds

Detailed Description

Time with millisecond precision.

The postime_t class offers system-independent time handling with millisecond precision. Using its member functions and operators, one can manipulate times in an inituive way.

Constructor & Destructor Documentation

postime_t::postime_t ( )

postime_t constructor

This constructor sets the number of seconds and the number of milliseconds to zero.

postime_t::postime_t ( int  msecs)

constructor with a number of milliseconds

This constructor takes a number of milliseconds. If this number is greater than 1000, the number is split in a number of seconds and a number of milliseconds. This function is mainly useful for offsets.

Parameters
msecsNumber of milliseconds
See Also
postime_t()

Member Function Documentation

int postime_t::after ( const postime_t t)

Number of milliseconds after t.

This function returns the amount of time between this time and the time specified by t. If this time is after t, this value is positive, if this time is before t, the return value is negative.

Parameters
tThe time to compare with
Returns
The number of milliseconds the time is after t
postime_t postime_t::operator+ ( const postime_t t)

time addition

This function adds t to the given time and returns the result. This is probably only useful if at least one of the given times is an offset.

Parameters
tThe time to add
Returns
The result of the addition
postime_t postime_t::operator+ ( int  t)

time millisecond addition

This function adds the given amount of milliseconds to the time and returns the result.

Parameters
tThe number of milliseconds to add
Returns
The result of the addition
postime_t & postime_t::operator+= ( const postime_t t)

time addition

This function adds t to the given time and returns the result. This is probably only useful if at least one of the given times is an offset.

Parameters
tThe time to add
Returns
This
postime_t & postime_t::operator+= ( int  t)

time millisecond addition

This function adds the given amount of milliseconds to the time and returns the result.

Parameters
tThe number of milliseconds to add
Returns
This
postime_t postime_t::operator- ( const postime_t t)

time substraction

This function substracts t from the given time and returns the result.

Parameters
tThe time to substract
Returns
The result of the substraction
bool postime_t::operator< ( const postime_t t)

less than

This operator checks whether this time is before the argument, t.

Parameters
tThe time to compare with
bool postime_t::operator<= ( const postime_t t)

less than or equal

This operator checks whether this time is before or the same as the argument, t.

Parameters
tThe time to compare with
postime_t & postime_t::operator= ( const postime_t t)

time assignment

This assignment operator copies the given time to the current time.

Parameters
tThe time to assign
Returns
The assigned time
bool postime_t::operator== ( const postime_t t)

equality check

This operator checks whether two times are equal, that is, both the number of seconds and the number of milliseconds are the same

Parameters
tThe time to compare with
bool postime_t::operator> ( const postime_t t)

greater than

This operator checks whether the time is after the argument, t.

Parameters
tThe time to compare with
bool postime_t::operator> ( const timespec &  t)

greater than timespec

This operator checks whether the time is after the argument, t. t is a timespec, as returned by the postimespec() function, and as required by pthread_cond_timedwait function.

Parameters
tThe time to compare with
See Also
postimespec()
bool postime_t::operator>= ( const postime_t t)

greater than or equal

This operator checks whether this time is after or the same as the argument, t.

Parameters
tThe time to compare with

Member Data Documentation

long postime_t::msec

number of milliseconds

This is the number of milliseconds. This value can range from 0 to

  1. If you assign a value greater than 999 to this, results are undefined.
long postime_t::sec

number of seconds

This is the number of seconds of the time. For absolute times, this is the number of seconds since the UNIX epoch as returned by the gettimeofday() function.


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