add:添加获取时间戳
This commit is contained in:
parent
f6bc83b0de
commit
931380105b
@ -48,6 +48,8 @@ public:
|
||||
static ofString now_time();
|
||||
static ofString get_file_size(long long bytes);
|
||||
static ofString get_uuid();
|
||||
static uint64_t get_timestamp_ms();
|
||||
static uint64_t get_timestamp_s();
|
||||
};
|
||||
|
||||
class CMutBuffer
|
||||
|
@ -150,6 +150,20 @@ ofString OfUtil::get_uuid()
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t OfUtil::get_timestamp_ms()
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
uint64_t ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
||||
return ms;
|
||||
}
|
||||
|
||||
uint64_t OfUtil::get_timestamp_s()
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
uint64_t s = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
std::string CCodec::u8_to_ansi(const std::string& str)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user