| 61 | } |
| 62 | |
| 63 | std::string FormatTimeSys(const steady_clock::time_point& timestamp) |
| 64 | { |
| 65 | const time_t now_s = ::time(NULL); // get current time in seconds |
| 66 | const steady_clock::time_point now_timestamp = steady_clock::now(); |
| 67 | const int64_t delta_us = count_microseconds(timestamp - now_timestamp); |
| 68 | const int64_t delta_s = |
| 69 | static_cast<int64_t>(floor((static_cast<double>(count_microseconds(now_timestamp.time_since_epoch()) % 1000000) + delta_us) / 1000000.0)); |
| 70 | const time_t tt = now_s + delta_s; |
| 71 | struct tm tm = SysLocalTime(tt); // in seconds |
| 72 | char tmp_buf[512]; |
| 73 | strftime(tmp_buf, 512, "%X.", &tm); |
| 74 | |
| 75 | ostringstream out; |
| 76 | out << tmp_buf << setfill('0') << setw(6) << (count_microseconds(timestamp.time_since_epoch()) % 1000000) << " [SYST]"; |
| 77 | return out.str(); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | #ifdef ENABLE_STDCXX_SYNC |