Skip to content

Commit

Permalink
use CLOCK_MONOTONIC_RAW instead of CLOCK_BOOTTIME
Browse files Browse the repository at this point in the history
  • Loading branch information
haileys committed Dec 29, 2023
1 parent 5ea6a9e commit 0a555d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bark/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use nix::time::ClockId;
use bark_protocol::types::TimestampMicros;

pub fn now() -> TimestampMicros {
let timespec = nix::time::clock_gettime(ClockId::CLOCK_BOOTTIME)
.expect("clock_gettime(CLOCK_BOOTTIME) failed, are we on Linux?");
let timespec = nix::time::clock_gettime(ClockId::CLOCK_MONOTONIC_RAW)
.expect("clock_gettime(CLOCK_MONOTONIC_RAW) failed, are we on Linux?");

let micros = u64::try_from(timespec.num_microseconds())
.expect("cannot convert i64 time value to u64");
Expand Down

0 comments on commit 0a555d4

Please sign in to comment.