mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Timestamp added
This commit is contained in:
26
Timestamp.h
Normal file
26
Timestamp.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef TIMESTAMP_H__
|
||||||
|
#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 ();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t GetHoursSinceEpoch ()
|
||||||
|
{
|
||||||
|
return std::chrono::duration_cast<std::chrono::hours>(
|
||||||
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user