Public Member Functions | Private Member Functions | Private Attributes | List of all members
KNI::Timer Class Reference

#include <Timer.h>

Public Member Functions

bool Elapsed () const
 
long ElapsedTime () const
 
void Set (long timeout)
 
void Set_And_Start (long timeout)
 
void Start ()
 
 Timer ()
 
 Timer (long timeout)
 
void WaitUntilElapsed () const
 

Private Member Functions

long _ElapsedTime () const
 Platform specific implementation of ElapsedTime(). More...
 

Private Attributes

struct timeval _ct
 
long _timeout
 

Detailed Description

Provides a stop-watch-like class with a resolution of milliseconds.

Definition at line 41 of file Timer.h.

Constructor & Destructor Documentation

KNI::Timer::Timer ( )

Definition at line 48 of file Timer.cpp.

KNI::Timer::Timer ( long  timeout)

Definition at line 49 of file Timer.cpp.

Member Function Documentation

long KNI::Timer::_ElapsedTime ( ) const
private

Platform specific implementation of ElapsedTime().

Definition at line 55 of file Timer.cpp.

bool KNI::Timer::Elapsed ( ) const

Returns true if timer is elapsed.

Definition at line 69 of file Timer.cpp.

long KNI::Timer::ElapsedTime ( ) const

Returns the elapsed time.

Definition at line 74 of file Timer.cpp.

void KNI::Timer::Set ( long  timeout)

Definition at line 30 of file Timer.cpp.

void KNI::Timer::Set_And_Start ( long  timeout)

Definition at line 64 of file Timer.cpp.

void KNI::Timer::Start ( )

Definition at line 51 of file Timer.cpp.

void KNI::Timer::WaitUntilElapsed ( ) const

Block until time's up.

WARNING: possible race-condition in sleep() if it takes longer than 1ms between the check and the real sleep.

Definition at line 78 of file Timer.cpp.

Member Data Documentation

struct timeval KNI::Timer::_ct
private

Definition at line 48 of file Timer.h.

long KNI::Timer::_timeout
private

Definition at line 43 of file Timer.h.


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


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:17