mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Timer: Added static ::now method for timestamps
This commit is contained in:
parent
f42de556fa
commit
ed58263c16
2 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
void subtract (unsigned long);
|
||||
|
||||
static unsigned long now ();
|
||||
|
||||
private:
|
||||
std::string _description;
|
||||
bool _running;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue