1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-15 09:39:58 +00:00
i2pd/Timestamp.h

35 lines
727 B
C
Raw Permalink Normal View History

2013-10-27 11:29:34 -04:00
#ifndef TIMESTAMP_H__
#define TIMESTAMP_H__
#include <inttypes.h>
#include <chrono>
namespace i2p
{
namespace util
{
2016-09-21 12:02:52 -04:00
extern std::chrono::system_clock::duration g_TimeOffset;
2013-10-27 11:29:34 -04:00
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 ();
}
2013-12-10 08:10:49 -05:00
inline uint64_t GetSecondsSinceEpoch ()
2013-12-10 08:10:49 -05:00
{
return std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count ();
}
2013-10-27 11:29:34 -04:00
}
}
#endif