Clock
dictates how timestamps are done in the Quicklog.
The idea is to use TSC time, storing a start TSC time, and a start System time.
We store TSC time when logging is done in Quicklog, only getting the System
time on the writer thread that is performance sensitive, as we would
be able to decode the true System time, given the delta between
Instant
of generating the log line and Instant
of the start time to get a
Duration
, which can be added to start System time to give a final DateTime<Utc>
.
Here's an example of how things are done in time taking.
use thread;
use ;
// initialize the clock, impls `Clock` trait
let clock = new;
let some_log_line_instant = clock.get_instant;
// add log_line onto some queue
// simulate flush thread
let flush_thread = spawn;
# flush_thread.join;