Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Time Class Reference

List of all members.

Detailed Description

A class encapsulating a duration or a point in time.

This class is named Time rather than time to avoid collisions with the time function.


Public Methods

 Time ()
 Default (null) constructor.

long long to_secs () const
 Returns the duration in seconds.

long long to_msecs () const
 Returns the duration in milliseconds.

long long to_usecs () const
 Returns the duration in microseconds.

timespec to_timespec () const
 Returns the duration as a timespec.

timeval to_timeval () const
 Returns the duration as a timeval.

 operator const void * () const
 Returns true unless the time is equal to the special Time::none() value.

Time operator+ (Time other) const
 Returns the sum of two times.

Time operator- (Time other) const
 Returns the difference of two times.

template<class T> Time operator * (T times) const
 Multiplies by a constant.

template<class T> Time operator/ (T times) const
 Divides by a constant.

Time & operator+= (Time other)
 Adds to this time.

Time & operator-= (Time other)
 Subtracts from this time.

 NMSTL_ARITH_OPS (Time, val)
string as_string () const
 Returns the time, in seconds, as a string.


Static Public Methods

Time now ()
 Returns the current time.

Time now_plus_secs (long long val)
 Returns the current time plus a certain number of seconds.

Time now_plus_msecs (long long val)
 Returns the current time plus a certain number of milliseconds.

Time now_plus_usecs (long long val)
 Returns the current time plus a certain number of microseconds.

template<class T> Time secs (T val)
 Creates a time value corresponding to a particular number of seconds.

Time secs (double val)
 Creates a time value corresponding to a particular number of seconds.

template<class T> Time msecs (T val)
 Creates a time value corresponding to a particular number of milliseconds.

Time msecs (double val)
 Creates a time value corresponding to a particular number of milliseconds.

template<class T> Time usecs (T val)
 Creates a time value corresponding to a particular number of microseconds.

Time usecs (double val)
 Creates a time value corresponding to a particular number of microseconds.

Time none ()
 Returns a special time value meaning "no time at all.".


Constructor & Destructor Documentation

Time::Time (    ) 
 

Default (null) constructor.


Member Function Documentation

string Time::as_string (    )  const
 

Returns the time, in seconds, as a string.

Time Time::msecs (  double    val )  [static]
 

Creates a time value corresponding to a particular number of milliseconds.

template<class T>
Time Time::msecs (  T    val )  [static]
 

Creates a time value corresponding to a particular number of milliseconds.

Time::NMSTL_ARITH_OPS (  Time   ,
val   
) 
 

Time Time::none (    )  [static]
 

Returns a special time value meaning "no time at all.".

Time Time::now (    )  [static]
 

Returns the current time.

Time Time::now_plus_msecs (  long long    val )  [static]
 

Returns the current time plus a certain number of milliseconds.

Time Time::now_plus_secs (  long long    val )  [static]
 

Returns the current time plus a certain number of seconds.

Time Time::now_plus_usecs (  long long    val )  [static]
 

Returns the current time plus a certain number of microseconds.

template<class T>
Time Time::operator * (  T    times )  const
 

Multiplies by a constant.

Time::operator const void * (    )  const
 

Returns true unless the time is equal to the special Time::none() value.

Time Time::operator+ (  Time    other )  const
 

Returns the sum of two times.

Time& Time::operator+= (  Time    other ) 
 

Adds to this time.

Time Time::operator- (  Time    other )  const
 

Returns the difference of two times.

Time& Time::operator-= (  Time    other ) 
 

Subtracts from this time.

template<class T>
Time Time::operator/ (  T    times )  const
 

Divides by a constant.

Time Time::secs (  double    val )  [static]
 

Creates a time value corresponding to a particular number of seconds.

template<class T>
Time Time::secs (  T    val )  [static]
 

Creates a time value corresponding to a particular number of seconds.

long long Time::to_msecs (    )  const
 

Returns the duration in milliseconds.

long long Time::to_secs (    )  const
 

Returns the duration in seconds.

timespec Time::to_timespec (    )  const
 

Returns the duration as a timespec.

timeval Time::to_timeval (    )  const
 

Returns the duration as a timeval.

long long Time::to_usecs (    )  const
 

Returns the duration in microseconds.

Time Time::usecs (  double    val )  [static]
 

Creates a time value corresponding to a particular number of microseconds.

template<class T>
Time Time::usecs (  T    val )  [static]
 

Creates a time value corresponding to a particular number of microseconds.


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:11 2002 for NMSTL