aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-10 07:41:04 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-10 07:41:04 +0300
commit0e6f29e3f6d1dc2ed7eb06a4c1e31814cefecdbb (patch)
tree05a5e5ddde654df12a26c2d0c884830277b7c416
parentAppVeyor: Release builds only on master (diff)
downloadmath-server-0e6f29e3f6d1dc2ed7eb06a4c1e31814cefecdbb.tar.gz
math-server-0e6f29e3f6d1dc2ed7eb06a4c1e31814cefecdbb.zip
server: use safe & portable Boost.DateTime functions
-rw-r--r--server/common/log.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/common/log.hpp b/server/common/log.hpp
index ca0fafd..48dd0f6 100644
--- a/server/common/log.hpp
+++ b/server/common/log.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/format.hpp>
#include <boost/system/error_code.hpp>
@@ -20,9 +21,10 @@ namespace details {
inline std::thread::id get_tid() { return std::this_thread::get_id(); }
inline std::string get_timestamp() {
- const auto tt = std::time(nullptr);
+ const auto now = boost::posix_time::second_clock::universal_time();
+ const auto tm = boost::posix_time::to_tm(now);
std::ostringstream oss;
- oss << std::put_time(std::gmtime(&tt), "%Y-%m-%d %H:%M:%S");
+ oss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
return oss.str();
}