summaryrefslogtreecommitdiffstats
path: root/src/LoggerListeners.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-24 13:56:56 +0200
committertycho <work.tycho@gmail.com>2015-05-24 13:56:56 +0200
commitdae9e5792a4f030ae9e748548a16a89790fbd311 (patch)
tree2142b8c4deb9f2c7ad096b8b0ec93fefccd8d8f1 /src/LoggerListeners.cpp
parentMerge branch 'master' into PreventNewWarnings (diff)
downloadcuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar.gz
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar.bz2
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar.lz
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar.xz
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.tar.zst
cuberite-dae9e5792a4f030ae9e748548a16a89790fbd311.zip
Diffstat (limited to 'src/LoggerListeners.cpp')
-rw-r--r--src/LoggerListeners.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp
index 5c7097956..cc2f883d8 100644
--- a/src/LoggerListeners.cpp
+++ b/src/LoggerListeners.cpp
@@ -3,6 +3,8 @@
#include "LoggerListeners.h"
+#include <chrono>
+
#if defined(_WIN32)
#include <io.h> // Needed for _isatty(), not available on Linux
#include <time.h>
@@ -280,7 +282,9 @@ cFileListener::cFileListener(void)
{
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
AString FileName;
- FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/", (int)time(nullptr));
+ auto time = std::chrono::system_clock::now();
+ FileName = Printf("%s%sLOG_%d.txt", FILE_IO_PREFIX, "logs/",
+ std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(time.time_since_epoch()).count());
m_File.Open(FileName, cFile::fmAppend);
}