Measures time intervals. More...

#include <cxxtools/clock.h>

Public Member Functions

 Clock ()
 Constructs a Clock.
 Clock (const Clock &cl)
Clockoperator= (const Clock &cl)
virtual ~Clock ()
 Destructor.
Timespan start ()
 Start the clock and return the current system ticks.
Timespan stop () const
 Stop the clock.

Static Public Member Functions

static DateTime getSystemTime ()
 Returns the system time.
static DateTime getLocalTime ()
 Returns the current local time.
static Timespan getSystemTicks ()
 Returns the timespan since a fixed point in the past.

Detailed Description

Measures time intervals.

The clock class can be used like a stop-watch by calling Clock::start() and Clock::stop(). The latter method returns the elapsed time.

Constructor & Destructor Documentation

cxxtools::Clock::Clock ( )

Constructs a Clock.

cxxtools::Clock::Clock ( const Clock cl)
virtual cxxtools::Clock::~Clock ( )
virtual

Destructor.

Member Function Documentation

static DateTime cxxtools::Clock::getLocalTime ( )
static

Returns the current local time.

static Timespan cxxtools::Clock::getSystemTicks ( )
static

Returns the timespan since a fixed point in the past.

The getSystemTicks function retrieves the system ticks, in milliseconds. The system time is the time elapsed since i.e. the system was started, or the unix epoch or some other fixed point in the past.

static DateTime cxxtools::Clock::getSystemTime ( )
static

Returns the system time.

Clock& cxxtools::Clock::operator= ( const Clock cl)
Timespan cxxtools::Clock::start ( )

Start the clock and return the current system ticks.

Timespan cxxtools::Clock::stop ( ) const

Stop the clock.

Can be called several times.

Returns the elapsed time since start was called. Since stop does not change the start time it can be called several times in order to get the elapsed time.


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