Timer: Added static ::now method for timestamps
This commit is contained in:
@@ -112,3 +112,11 @@ void Timer::subtract (unsigned long value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
unsigned long Timer::now ()
|
||||||
|
{
|
||||||
|
struct timeval now;
|
||||||
|
gettimeofday (&now, NULL);
|
||||||
|
return now.tv_sec * 1000000 + now.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
unsigned long total () const;
|
unsigned long total () const;
|
||||||
void subtract (unsigned long);
|
void subtract (unsigned long);
|
||||||
|
|
||||||
|
static unsigned long now ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _description;
|
std::string _description;
|
||||||
bool _running;
|
bool _running;
|
||||||
|
|||||||
Reference in New Issue
Block a user