Private Types | Private Member Functions | List of all members
blaze::SystemClock Class Reference

System clock of the Blaze library.The SystemClock class represents the system clock of the Blaze library. The system clock is the central timing functionality that can be used to query for the start time of the process, the current timestamp and the elapsed time since the start of the process. The following example demonstrates how the single system clock instance is acquired via the theSystemClock() functcion and how the system clock can be used: More...

#include <SystemClock.h>

Inherits blaze::Singleton< SystemClock >.

Public Member Functions

Destructor
 ~SystemClock ()
 Destructor for the SystemClock class.
 
Utility functions
time_t start () const
 Returns the timestamp for the start of the process. More...
 
time_t now () const
 Returns the current timestamp. More...
 
time_t elapsed () const
 Returns the elapsed time since the start of the process (in seconds). More...
 

Private Types

typedef Singleton< SystemClock, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullTypeSingletonType
 Type of this Singleton instance.
 

Private Member Functions

typedef BLAZE_TYPELIST_8 (NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType) Dependencies
 Type list of all lifetime dependencies.
 
Constructors
 SystemClock ()
 Constructor for the SystemClock class.
 

Static Private Member Functions

Instance function
static boost::shared_ptr< SystemClockinstance ()
 

Static Private Attributes

Member variables
static time_t start_
 Timestamp for the start of the process.
 
Member variables
static boost::mutex instanceMutex_
 Synchronization mutex for access to the singleton.
 

Detailed Description

System clock of the Blaze library.

The SystemClock class represents the system clock of the Blaze library. The system clock is the central timing functionality that can be used to query for the start time of the process, the current timestamp and the elapsed time since the start of the process. The following example demonstrates how the single system clock instance is acquired via the theSystemClock() functcion and how the system clock can be used:

// The single system clock instance is accessible via the theSystemClock() function
SystemClockID systemClock = theSystemClock();
time_t start = systemClock->start(); // Querying the start time of the process
time_t current = systemClock->current(); // Querying the current timestamp
time_t elapsed = systemClock->elapsed(); // Querying the elapsed time

Member Function Documentation

time_t blaze::SystemClock::elapsed ( ) const
inline

Returns the elapsed time since the start of the process (in seconds).

Returns
Elapsed time since the start of the process (in seconds).
time_t blaze::SystemClock::now ( ) const
inline

Returns the current timestamp.

Returns
The current timestamp.
time_t blaze::SystemClock::start ( ) const
inline

Returns the timestamp for the start of the process.

Returns
Timestamp for the start of the process.

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