UtiLite  0.3.1
A lite utilities library
Public Member Functions | Static Public Member Functions
UTimer Class Reference

#include <UTimer.h>

List of all members.

Public Member Functions

void start ()
void stop ()
double elapsed ()
 DEPRECATED (double getInterval())
double restart ()

Static Public Member Functions

static double now ()

Detailed Description

This class is used to time some codes (in seconds). On Unix, the resolution is up to microseconds (see gettimeofday()). On Windows, the performance counter is used (see QueryPerformanceCounter() and QueryPerformanceFrequency()). Example:

      UTimer timer;
      timer.start();
      ... (do some work)
      timer.stop();
      double seconds = timer.getInterval();
      ...

Member Function Documentation

UTimer::DEPRECATED ( double   getInterval())

This method is used to get the interval time between stop() and the start().

Returns:
double the interval in seconds.
Deprecated:
use elapsed() instead.
double UTimer::elapsed ( ) [inline]

This method is used to get the elapsed time between now and the start(). If timer is stopped, the interval time between stop() and the start() is returned.

Returns:
double the interval in seconds.
double UTimer::now ( ) [static]

This method is used to get the time of the system right now.

Returns:
double the time in seconds.
double UTimer::restart ( ) [inline]

This method is used to get the interval of the timer while it is running. It's automatically stop the timer, get the interval and restart the timer. It's the same of calling stop(), elapsed() and start(). Method restart() does the same thing, for convenience.

Returns:
double the interval in seconds.
void UTimer::start ( )

This method starts the timer.

void UTimer::stop ( )

This method stops the timer.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Friends Defines