Original Post
🔒 Locked
Timers
Advertisement
#ifndef TDTIMER_H //timer.h
#define TDTIMER_H
class CTimer {
public:
void Initialize(void);
unsigned long GetElapsedTime(void);
private:
unsigned long initTime;
unsigned long currentTime;
unsigned long lastCallTime;
unsigned long elapsedTime;
};
#endif
//timer.cpp
#include "timer.h"
#include "windows.h"
void CTimer::Initialize()
{
initTime = GetTickCount();
lastCallTime = initTime;
}
unsigned long CTimer::GetElapsedTime()
{
elapsedTime = GetTickCount() - lastCallTime;
return elapsedTime * 0.1; //Return in 100th of a second
}
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement