From bd7bc17ce2e6a40fd73bf05dee11d815ec214678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz> Date: Sat, 17 Nov 2018 14:38:55 +0100 Subject: [PATCH] Used std::put_time instead of std::strftime in SystemInfo --- src/TNL/Devices/SystemInfo.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/TNL/Devices/SystemInfo.cpp b/src/TNL/Devices/SystemInfo.cpp index 38f8523015..9ad5e19b9f 100644 --- a/src/TNL/Devices/SystemInfo.cpp +++ b/src/TNL/Devices/SystemInfo.cpp @@ -11,7 +11,6 @@ #include <set> #include <iomanip> #include <cstring> -#include <ctime> #include <unistd.h> #include <sys/utsname.h> @@ -65,13 +64,9 @@ SystemInfo::getCurrentTime( const char* format ) { const std::time_t time_since_epoch = std::time( nullptr ); std::tm* localtime = std::localtime( &time_since_epoch ); - // TODO: use std::put_time in the future (available since GCC 5) -// std::stringstream ss; -// ss << std::put_time( localtime, format ); -// return String( ss.str().c_str() ); - char buffer[1024]; - std::strftime( buffer, 1024, format, localtime ); - return String( buffer ); + std::stringstream ss; + ss << std::put_time( localtime, format ); + return String( ss.str().c_str() ); } -- GitLab