mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
743 B
33 lines
743 B
11 years ago
|
#ifndef TIMESTAMP_H__
|
||
|
#define TIMESTAMP_H__
|
||
|
|
||
|
#include <inttypes.h>
|
||
|
#include <chrono>
|
||
|
|
||
|
namespace i2p
|
||
|
{
|
||
|
namespace util
|
||
|
{
|
||
9 years ago
|
inline uint64_t GetMillisecondsSinceEpoch ()
|
||
|
{
|
||
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||
|
}
|
||
11 years ago
|
|
||
9 years ago
|
inline uint32_t GetHoursSinceEpoch ()
|
||
|
{
|
||
|
return std::chrono::duration_cast<std::chrono::hours>(
|
||
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||
|
}
|
||
11 years ago
|
|
||
9 years ago
|
inline uint64_t GetSecondsSinceEpoch ()
|
||
|
{
|
||
|
return std::chrono::duration_cast<std::chrono::seconds>(
|
||
|
std::chrono::system_clock::now().time_since_epoch()).count ();
|
||
|
}
|
||
11 years ago
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|