#ifndef TIMER_H
#define TIMER_H
 
#include <windows.h>
#include "../include/types.h"
 
#define TIMER_PRECISION_S             1
#define TIMER_PRECISION_TENTH_S       10
#define TIMER_PRECISION_HUNDREDTH_S   100
#define TIMER_PRECISION_MILLISECOND   1000
#define TIMER_PRECISION_TENTH_MS      10000
#define TIMER_PRECISION_HUNDREDTH_MS  100000
#define TIMER_PRECISION_THOUSANDTH_MS 1000000
 
class TTimer {
private:  
	int64 startValue;
	int64 actualValue;
	int64 counterFrequency;
	int32 msOffset;
public:
	TTimer();
 
	void start(void);
	void setOffset(int32 offset);
  int32 MulDiv64(int64 nNumber, int64 nNumerator, int64 nDenominator);
	int32 getTicks(void);
	int32 getMs(void);
	int32 getTicksPerSecond(void);
	int32 getPrecisionTimeCount(int32 precision);
	int32 getCurrentFrame(int32 totalframes, int32 totalms);
};
 
 
#endif

Download timer.h timer.h - 0.8 KB