mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-14 10:06:52 +02:00
NTP time sync
This commit is contained in:
parent
42b556574f
commit
85394f2438
4 changed files with 78 additions and 21 deletions
|
@ -2,29 +2,16 @@
|
|||
#define TIMESTAMP_H__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
inline uint64_t GetMillisecondsSinceEpoch ()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||||
}
|
||||
uint64_t GetMillisecondsSinceEpoch ();
|
||||
uint32_t GetHoursSinceEpoch ();
|
||||
uint64_t GetSecondsSinceEpoch ();
|
||||
|
||||
inline uint32_t GetHoursSinceEpoch ()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::hours>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||||
}
|
||||
|
||||
inline uint64_t GetSecondsSinceEpoch ()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||||
}
|
||||
void RequestNTPTimeSync ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue