We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8b63059 commit 898484dCopy full SHA for 898484d
1 file changed
crates/codspeed/src/instrument_hooks/mod.rs
@@ -3,7 +3,6 @@ mod ffi;
3
4
#[cfg(use_instrument_hooks)]
5
mod linux_impl {
6
- use nix::sys::time::TimeValLike;
7
8
use super::ffi;
9
use std::ffi::CString;
@@ -116,9 +115,19 @@ mod linux_impl {
116
115
117
#[inline(always)]
118
pub fn current_timestamp() -> u64 {
119
- nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC)
120
- .expect("Failed to get current time")
121
- .num_nanoseconds() as u64
+ #[cfg(target_os = "linux")]
+ {
+ use nix::sys::time::TimeValLike;
+
122
+ nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC)
123
+ .expect("Failed to get current time")
124
+ .num_nanoseconds() as u64
125
+ }
126
127
+ #[cfg(not(target_os = "linux"))]
128
+ unsafe {
129
+ ffi::instrument_hooks_current_timestamp()
130
131
}
132
133
0 commit comments