Commit 62fae04d authored by Max Lyon's avatar Max Lyon
Browse files

implement time string for linux

parent 288784fe
......@@ -54,8 +54,8 @@ std::string time()
time_t rawtime;
struct tm timeinfo;
#ifdef WIN32
struct tm timeinfo;
int err = ::localtime_s(&timeinfo, &rawtime);
if (err == 0)
......@@ -66,10 +66,10 @@ std::string time()
return std::string("time() failed");
//TODO: Implement a secure version of this code for Linux, OSX
//timeinfo = *localtime(&rawtime);
//char* buffer = asctime(&timeinfo);
return std::string("TODO: time() implemented only on Windows");
char str[100];
// Format: <Abbreviated weekday name> <abbreviated month name> <day of month> <HH>:<MM>:<SS> <Year>
std::strftime(str, sizeof(str), "%a %b %d %H:%M:%S %Y", std::localtime(&rawtime));
return std::string(str);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment