aboutsummaryrefslogtreecommitdiff
path: root/src/util/time.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/time.cpp')
-rw-r--r--src/util/time.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/time.cpp b/src/util/time.cpp
index c0ede98701..83a7937d8f 100644
--- a/src/util/time.cpp
+++ b/src/util/time.cpp
@@ -97,3 +97,14 @@ std::string FormatISO8601Date(int64_t nTime) {
#endif
return strprintf("%04i-%02i-%02i", ts.tm_year + 1900, ts.tm_mon + 1, 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);
+}