Skip to content
Snippets Groups Projects
Commit bd7bc17c authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Used std::put_time instead of std::strftime in SystemInfo

parent 32c75310
No related branches found
No related tags found
1 merge request!22Header only
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <set> #include <set>
#include <iomanip> #include <iomanip>
#include <cstring> #include <cstring>
#include <ctime>
#include <unistd.h> #include <unistd.h>
#include <sys/utsname.h> #include <sys/utsname.h>
...@@ -65,13 +64,9 @@ SystemInfo::getCurrentTime( const char* format ) ...@@ -65,13 +64,9 @@ SystemInfo::getCurrentTime( const char* format )
{ {
const std::time_t time_since_epoch = std::time( nullptr ); const std::time_t time_since_epoch = std::time( nullptr );
std::tm* localtime = std::localtime( &time_since_epoch ); std::tm* localtime = std::localtime( &time_since_epoch );
// TODO: use std::put_time in the future (available since GCC 5) std::stringstream ss;
// std::stringstream ss; ss << std::put_time( localtime, format );
// ss << std::put_time( localtime, format ); return String( ss.str().c_str() );
// return String( ss.str().c_str() );
char buffer[1024];
std::strftime( buffer, 1024, format, localtime );
return String( buffer );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment