Converts the given epoch time in milliseconds to a date string in the RFC3339 format, without the timezone information.
| 5547 | // Converts the given epoch time in milliseconds to a date string in the |
| 5548 | // RFC3339 format, without the timezone information. |
| 5549 | static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) { |
| 5550 | struct tm time_struct; |
| 5551 | if (!PortableLocaltime(static_cast<time_t>(ms / 1000), &time_struct)) |
| 5552 | return ""; |
| 5553 | // YYYY-MM-DDThh:mm:ss |
| 5554 | return StreamableToString(time_struct.tm_year + 1900) + "-" + |
| 5555 | String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + |
| 5556 | String::FormatIntWidth2(time_struct.tm_mday) + "T" + |
| 5557 | String::FormatIntWidth2(time_struct.tm_hour) + ":" + |
| 5558 | String::FormatIntWidth2(time_struct.tm_min) + ":" + |
| 5559 | String::FormatIntWidth2(time_struct.tm_sec) + "Z"; |
| 5560 | } |
| 5561 | |
| 5562 | static inline std::string Indent(size_t width) { |
| 5563 | return std::string(width, ' '); |
no test coverage detected