Passenger::SystemTime Class Reference

This class allows one to obtain the system time, similar to time() and gettimeofday(). More...

#include <SystemTime.h>

List of all members.

Static Public Member Functions

static time_t get ()
 Returns the time since the Epoch, measured in seconds.
static unsigned long long getMsec ()
 Returns the time since the Epoch, measured in milliseconds.
static unsigned long long getUsec ()
 Returns the time since the Epoch, measured in microseconds.
static void force (time_t value)
 Force get() to return the given value.
static void forceMsec (unsigned long long value)
 Force getMsec() to return the given value.
static void forceUsec (unsigned long long value)
 Force getUsec() to return the given value.
static void release ()
 Release the previously forced seconds value, so that get() returns the system time once again.
static void releaseMsec ()
 Release the previously forced msec value, so that getMsec() returns the system time once again.
static void releaseUsec ()
 Release the previously forced usec value, so that getUsec() returns the system time once again.
static void releaseAll ()
 Release all previously forced values, so that get(), getMsec() and getUsec() return the system time once again.


Detailed Description

This class allows one to obtain the system time, similar to time() and gettimeofday().

Unlike time(), it is possible to force a certain time to be returned, which is useful for testing code that depends on the system time.

get() provides seconds resolution while getMsec() provides milliseconds resolution. Both clocks can be independently forced to a certain value through force() and forceMsec().


Member Function Documentation

static time_t Passenger::SystemTime::get (  )  [inline, static]

Returns the time since the Epoch, measured in seconds.

Or, if a time was forced with force(), then the forced time is returned instead.

Exceptions:
TimeRetrievalException Something went wrong while retrieving the time.
boost::thread_interrupted 

static unsigned long long Passenger::SystemTime::getMsec (  )  [inline, static]

Returns the time since the Epoch, measured in milliseconds.

Or, if a time was forced with forceMsec(), then the forced time is returned instead.

Exceptions:
TimeRetrievalException Something went wrong while retrieving the time.
boost::thread_interrupted 

static unsigned long long Passenger::SystemTime::getUsec (  )  [inline, static]

Returns the time since the Epoch, measured in microseconds.

Or, if a time was forced with forceUsec(), then the forced time is returned instead.

Exceptions:
TimeRetrievalException Something went wrong while retrieving the time.
boost::thread_interrupted 


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

Generated on Mon Feb 8 22:53:23 2010 for Passenger by  doxygen 1.5.8