mirror of
https://github.com/nzp-team/vhlt.git
synced 2024-11-24 12:51:44 +00:00
49 lines
721 B
C
49 lines
721 B
C
|
#ifndef TIMECOUNTER_H__
|
||
|
#define TIMECOUNTER_H__
|
||
|
|
||
|
#if _MSC_VER >= 1000
|
||
|
#pragma once
|
||
|
#endif
|
||
|
|
||
|
#include "cmdlib.h"
|
||
|
|
||
|
class TimeCounter
|
||
|
{
|
||
|
public:
|
||
|
void start()
|
||
|
{
|
||
|
start = I_FloatTime();
|
||
|
}
|
||
|
|
||
|
void stop()
|
||
|
{
|
||
|
double stop = I_FloatTime();
|
||
|
accum += stop - start;
|
||
|
}
|
||
|
|
||
|
double getTotal() const
|
||
|
{
|
||
|
return accum;
|
||
|
}
|
||
|
|
||
|
void reset()
|
||
|
{
|
||
|
memset(this, 0, sizeof(*this));
|
||
|
}
|
||
|
|
||
|
// Construction
|
||
|
public:
|
||
|
TimeCounter()
|
||
|
{
|
||
|
reset();
|
||
|
}
|
||
|
// Default Destructor ok
|
||
|
// Default Copy Constructor ok
|
||
|
// Default Copy Operator ok
|
||
|
|
||
|
protected:
|
||
|
double start;
|
||
|
double accum;
|
||
|
};
|
||
|
|
||
|
#endif//TIMECOUNTER_H__
|