diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-13 22:32:59 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-13 22:32:59 +0200 |
| commit | 103b7f8b7551ca99023f100002ed08bea72e011a (patch) | |
| tree | 41a354093821f808a869f0ffc21c19365467f353 /server/common/log.hpp | |
| parent | upgrade to std::format (diff) | |
| download | math-server-103b7f8b7551ca99023f100002ed08bea72e011a.tar.gz math-server-103b7f8b7551ca99023f100002ed08bea72e011a.zip | |
use std:: facilities for timestamp formatting
Diffstat (limited to '')
| -rw-r--r-- | server/common/log.hpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/server/common/log.hpp b/server/common/log.hpp index 505faed..573590b 100644 --- a/server/common/log.hpp +++ b/server/common/log.hpp @@ -5,10 +5,8 @@ #pragma once -#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/system/error_code.hpp> -#include <ctime> #include <exception> #include <format> #include <iomanip> @@ -20,7 +18,6 @@ #include <utility> namespace math::server::log { - namespace details { inline std::string get_tid() { @@ -30,11 +27,8 @@ inline std::string get_tid() { } inline std::string get_timestamp() { - 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(&tm, "%Y-%m-%d %H:%M:%S"); - return oss.str(); + const auto now = std::chrono::system_clock::now(); + return std::format("{:%F %T%z}", std::chrono::floor<std::chrono::seconds>(now)); } inline void log(const std::string& msg) { |
