From: Sage Weil Date: Thu, 25 Apr 2019 17:41:19 +0000 (-0500) Subject: include/utime: make gmtime() output conformant ISO 8601 X-Git-Tag: v15.1.0~2616^2~16 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ec3ddcb9886e3c74b78aa8521bc05e695f6aeeab;p=ceph-ci.git include/utime: make gmtime() output conformant ISO 8601 Use 'T' separated instead of ' '. Signed-off-by: Sage Weil --- diff --git a/src/include/utime.h b/src/include/utime.h index 0a6f48d5230..b6d6cbe804b 100644 --- a/src/include/utime.h +++ b/src/include/utime.h @@ -241,14 +241,14 @@ public: out << (long)sec() << "." << std::setw(6) << usec(); } else { // this looks like an absolute time. - // aim for http://en.wikipedia.org/wiki/ISO_8601 + // conform to http://en.wikipedia.org/wiki/ISO_8601 struct tm bdt; time_t tt = sec(); gmtime_r(&tt, &bdt); out << std::setw(4) << (bdt.tm_year+1900) // 2007 -> '07' << '-' << std::setw(2) << (bdt.tm_mon+1) << '-' << std::setw(2) << bdt.tm_mday - << ' ' + << 'T' << std::setw(2) << bdt.tm_hour << ':' << std::setw(2) << bdt.tm_min << ':' << std::setw(2) << bdt.tm_sec; @@ -270,14 +270,14 @@ public: out << (long)sec() << "." << std::setw(6) << usec(); } else { // this looks like an absolute time. - // aim for http://en.wikipedia.org/wiki/ISO_8601 + // conform to http://en.wikipedia.org/wiki/ISO_8601 struct tm bdt; time_t tt = sec(); gmtime_r(&tt, &bdt); out << std::setw(4) << (bdt.tm_year+1900) // 2007 -> '07' << '-' << std::setw(2) << (bdt.tm_mon+1) << '-' << std::setw(2) << bdt.tm_mday - << ' ' + << 'T' << std::setw(2) << bdt.tm_hour << ':' << std::setw(2) << bdt.tm_min << ':' << std::setw(2) << bdt.tm_sec;