mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-24 12:39:28 +00:00
Add milliseconds to log.
This commit is contained in:
parent
1774b42345
commit
5d9648956b
1 changed files with 6 additions and 3 deletions
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
#include "base/kernel/interfaces/ILogBackend.h"
|
#include "base/kernel/interfaces/ILogBackend.h"
|
||||||
|
#include "base/tools/Chrono.h"
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
@ -134,7 +135,8 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t now = time(nullptr);
|
const uint64_t ms = Chrono::currentMSecsSinceEpoch();
|
||||||
|
time_t now = ms / 1000;
|
||||||
tm stime;
|
tm stime;
|
||||||
|
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
|
@ -143,13 +145,14 @@ private:
|
||||||
localtime_r(&now, &stime);
|
localtime_r(&now, &stime);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
const int rc = snprintf(m_buf, sizeof(m_buf) - 1, "[%d-%02d-%02d %02d:%02d:%02d] ",
|
const int rc = snprintf(m_buf, sizeof(m_buf) - 1, "[%d-%02d-%02d %02d:%02d:%02d" BLACK_BOLD(".%03d") "] ",
|
||||||
stime.tm_year + 1900,
|
stime.tm_year + 1900,
|
||||||
stime.tm_mon + 1,
|
stime.tm_mon + 1,
|
||||||
stime.tm_mday,
|
stime.tm_mday,
|
||||||
stime.tm_hour,
|
stime.tm_hour,
|
||||||
stime.tm_min,
|
stime.tm_min,
|
||||||
stime.tm_sec
|
stime.tm_sec,
|
||||||
|
static_cast<int>(ms % 1000)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
|
|
Loading…
Reference in a new issue