-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtimeref.cpp
38 lines (30 loc) · 918 Bytes
/
timeref.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright (c) 2012-2023 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
*/
#include <chrono>
#include <deconz/timeref.h>
namespace deCONZ {
int64_t msecSinceEpoch()
{
return std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::system_clock::now().time_since_epoch()).count();
}
SteadyTimeRef steadyTimeRef() noexcept
{
return {
std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::steady_clock::now().time_since_epoch()).count()
};
}
SystemTimeRef systemTimeRef() noexcept
{
return std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::system_clock::now().time_since_epoch()).count();
}
} // namespace deCONZ