feat(Core/Common): add new helpers for time utility (#10207)

This commit is contained in:
Kargatum
2022-01-19 12:01:59 +07:00
committed by GitHub
parent b5ab409614
commit 259b9133f6
60 changed files with 732 additions and 341 deletions

View File

@@ -19,6 +19,7 @@
#include "Errors.h"
#include "Log.h"
#include "MessageBuffer.h"
#include "Timer.h"
#include "Util.h"
#include <ctime>
#include <sstream>
@@ -136,8 +137,7 @@ void ByteBuffer::append(uint8 const* src, size_t cnt)
void ByteBuffer::AppendPackedTime(time_t time)
{
tm lt;
localtime_r(&time, &lt);
tm lt = Acore::Time::TimeBreakdown(time);
append<uint32>((lt.tm_year - 100) << 24 | lt.tm_mon << 20 | (lt.tm_mday - 1) << 14 | lt.tm_wday << 11 | lt.tm_hour << 6 | lt.tm_min);
}