Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

postime_t Class Reference

Time with millisecond precision. More...

List of all members.


Public Member Functions

  postime_t ()
  postime_t constructor

  postime_t (int msecs)
  constructor with a number of milliseconds

postime_t operator= (const postime_t &t)
  time assignment

bool  operator== (const postime_t &t)
  equality check

bool  operator<= (const postime_t &t)
  less than or equal

bool  operator< (const postime_t &t)
  less than

bool  operator>= (const postime_t &t)
  greater than or equal

bool  operator> (const postime_t &t)
  greater than

bool  operator> (const timespec &t)
  greater than timespec

int  after (const postime_t &t)
  Number of milliseconds after t.

postime_t  operator- (const postime_t &t)
  time substraction

postime_t  operator+ (const postime_t &t)
  time addition

postime_t  operator+ (int t)
  time millisecond addition

postime_t operator+= (const postime_t &t)
  time addition

postime_t operator+= (int t)
  time millisecond addition


Public Attributes

long  sec
  number of seconds

long  msec
  number of milliseconds


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.

Definition at line 41 of file postime.h.


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:
msecs  Number 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:
t  The time to compare with
Returns:
The number of milliseconds the time is after t

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:
t  The 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:
t  The 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:
t  The number of milliseconds to add
Returns:
This

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:
t  The time 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:
t  The 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:
t  The 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:
t  The 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:
t  The 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:
t  The 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:
t  The time to compare with
See also:
postimespec()

bool postime_t::operator> const postime_t t  ) 
 

greater than

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

Parameters:
t  The time to compare with

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:
t  The 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 999. If you assign a value greater than 999 to this, results are undefined.

Definition at line 88 of file postime.h.

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.

Definition at line 79 of file postime.h.


The documentation for this class was generated from the following file:
Generated on Fri Dec 24 19:55:17 2004 for Poslib by doxygen 1.3.7