MCPcopy Create free account
hub / github.com/Samsung/rlottie / format_timestamp

Function format_timestamp

src/vector/vdebug.cpp:49–64  ·  view source on GitHub ↗

I want [2016-10-13 00:01:23.528514] */

Source from the content-addressed store, hash-verified

47
48/* I want [2016-10-13 00:01:23.528514] */
49void format_timestamp(std::ostream& os, uint64_t timestamp)
50{
51 // The next 3 lines do not work on MSVC!
52 // auto duration = std::chrono::microseconds(timestamp);
53 // std::chrono::high_resolution_clock::time_point time_point(duration);
54 // std::time_t time_t =
55 // std::chrono::high_resolution_clock::to_time_t(time_point);
56 std::time_t time_t = timestamp / 1000000;
57 auto gmtime = std::gmtime(&time_t);
58 char buffer[32];
59 strftime(buffer, 32, "%Y-%m-%d %T.", gmtime);
60 char microseconds[7];
61 snprintf(microseconds, 7, "%06llu",
62 (long long unsigned int)timestamp % 1000000);
63 os << '[' << buffer << microseconds << ']';
64}
65
66std::thread::id this_thread_id()
67{

Callers 1

stringifyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected