2013-10-27 19:29:34 +04:00
|
|
|
#ifndef TIMESTAMP_H__
|
|
|
|
#define TIMESTAMP_H__
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
|
|
|
namespace util
|
|
|
|
{
|
2015-07-17 00:29:52 +03:00
|
|
|
inline uint64_t GetMillisecondsSinceEpoch ()
|
|
|
|
{
|
|
|
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
|
|
|
}
|
2013-10-27 19:29:34 +04:00
|
|
|
|
2015-07-17 00:29:52 +03:00
|
|
|
inline uint32_t GetHoursSinceEpoch ()
|
|
|
|
{
|
|
|
|
return std::chrono::duration_cast<std::chrono::hours>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
|
|
|
}
|
2013-12-10 17:10:49 +04:00
|
|
|
|
2015-07-17 00:29:52 +03:00
|
|
|
inline uint64_t GetSecondsSinceEpoch ()
|
|
|
|
{
|
|
|
|
return std::chrono::duration_cast<std::chrono::seconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
|
|
|
}
|
2013-10-27 19:29:34 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|