| 37 | { |
| 38 | |
| 39 | std::string FormatTime(const steady_clock::time_point& timestamp) |
| 40 | { |
| 41 | if (is_zero(timestamp)) |
| 42 | { |
| 43 | // Use special string for 0 |
| 44 | return "00:00:00.000000 [STDY]"; |
| 45 | } |
| 46 | |
| 47 | const int decimals = clockSubsecondPrecision(); |
| 48 | const uint64_t total_sec = count_seconds(timestamp.time_since_epoch()); |
| 49 | const uint64_t days = total_sec / (60 * 60 * 24); |
| 50 | const uint64_t hours = total_sec / (60 * 60) - days * 24; |
| 51 | const uint64_t minutes = total_sec / 60 - (days * 24 * 60) - hours * 60; |
| 52 | const uint64_t seconds = total_sec - (days * 24 * 60 * 60) - hours * 60 * 60 - minutes * 60; |
| 53 | ostringstream out; |
| 54 | if (days) |
| 55 | out << days << "D "; |
| 56 | out << setfill('0') << setw(2) << hours << ":" |
| 57 | << setfill('0') << setw(2) << minutes << ":" |
| 58 | << setfill('0') << setw(2) << seconds << "." |
| 59 | << setfill('0') << setw(decimals) << (timestamp - seconds_from(total_sec)).time_since_epoch().count() << " [STDY]"; |
| 60 | return out.str(); |
| 61 | } |
| 62 | |
| 63 | std::string FormatTimeSys(const steady_clock::time_point& timestamp) |
| 64 | { |