Changeset View
Changeset View
Standalone View
Standalone View
src/util/time.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
#ifdef _MSC_VER | #ifdef _MSC_VER | ||||
gmtime_s(&ts, &time_val); | gmtime_s(&ts, &time_val); | ||||
#else | #else | ||||
gmtime_r(&time_val, &ts); | gmtime_r(&time_val, &ts); | ||||
#endif | #endif | ||||
return strprintf("%04i-%02i-%02i", ts.tm_year + 1900, ts.tm_mon + 1, | return strprintf("%04i-%02i-%02i", ts.tm_year + 1900, ts.tm_mon + 1, | ||||
ts.tm_mday); | ts.tm_mday); | ||||
} | } | ||||
std::string FormatISO8601Time(int64_t nTime) { | |||||
struct tm ts; | |||||
time_t time_val = nTime; | |||||
#ifdef _MSC_VER | |||||
gmtime_s(&ts, &time_val); | |||||
#else | |||||
gmtime_r(&time_val, &ts); | |||||
#endif | |||||
return strprintf("%02i:%02i:%02iZ", ts.tm_hour, ts.tm_min, ts.tm_sec); | |||||
} |