Timer Class Reference

Simple timer class, works in milliseconds. More...

#include <Timer.h>

Public Member Functions

 Timer (long TimeToGoMs)
void Start ()
 starts the timer
void Start (long TimeToGoMs)
void SetDelay (long delay)
int IsDone ()
 whether m_TimeToGo ms have elapsed since the last call of Start();

Protected Attributes

struct timeval m_TV
long m_TimeToGo
long m_StartTime

Detailed Description

Simple timer class, works in milliseconds.

Definition at line 45 of file Timer.h.


Member Function Documentation

int Timer::IsDone (  ) 

whether m_TimeToGo ms have elapsed since the last call of Start();

Returns:
1 if the time has elapsed, 0 otherwise

Definition at line 42 of file Timer.cpp.

00042                  {
00043   long currTime;
00044 #ifdef WIN32
00045   currTime = GetTickCount();  
00046 #else
00047   struct timeval mCTV;
00048   gettimeofday(&mCTV,NULL);
00049   currTime      = mCTV.tv_sec *1000;
00050   currTime     += mCTV.tv_usec/1000;
00051 #endif
00052   if((currTime-m_StartTime)>m_TimeToGo)
00053     return TRUE;
00054   return FALSE;
00055 }


The documentation for this class was generated from the following files:
 All Data Structures Functions Variables

Generated on Wed Sep 22 16:51:27 2010 for Body_Schema_Learning by  doxygen 1.6.1