blob: 1dc932351c00b22d19bdd2e500d212522e4eb0ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "../include/dchat/Clock.hpp"
#include <chrono>
namespace dchat
{
static i64 getCurrentTimeMillis()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
}
Clock::Clock()
{
restart();
}
void Clock::restart()
{
startTime = getCurrentTimeMillis();
}
i64 Clock::getElapsedTimeMillis() const
{
return getCurrentTimeMillis() - startTime;
}
}
|