1 2 | #include <chrono> uint64_t timestamp = std::chrono::system_clock::now().time_since_epoch().count(); |
'timestamp' is in ns, not in us(μs or microsecond).
1 2 3 4 5 6 | 1 s = 1000 ms 1 ms = 1000 μs 1 μs = 1000 ns 1 ns = 1000 ps 2 GHz = 2 x 10^9 Hz, its 1 circle has 0.5 ns long. |