Skip to content

Commit

Permalink
haiku: update libc dep and enable clock_getres
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Hoang committed May 7, 2022
1 parent 54b2047 commit 599ac91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ targets = [
]

[dependencies]
libc = { version = "0.2.121", features = [ "extra_traits" ] }
libc = { version = "0.2.125", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "1.0"

Expand Down
4 changes: 2 additions & 2 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl ClockId {
}

/// Returns resolution of the clock id
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg(not(target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn res(self) -> Result<TimeSpec> {
clock_getres(self)
Expand Down Expand Up @@ -212,7 +212,7 @@ impl std::fmt::Display for ClockId {

/// Get the resolution of the specified clock, (see
/// [clock_getres(2)](https://pubs.opengroup.org/onlinepubs/7908799/xsh/clock_getres.html)).
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg(not(target_os = "redox"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn clock_getres(clock_id: ClockId) -> Result<TimeSpec> {
let mut c_time: MaybeUninit<libc::timespec> = MaybeUninit::uninit();
Expand Down
4 changes: 2 additions & 2 deletions test/test_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use nix::time::clock_getcpuclockid;
use nix::time::{clock_gettime, ClockId};

#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg(not(target_os = "redox"))]
#[test]
pub fn test_clock_getres() {
assert!(nix::time::clock_getres(ClockId::CLOCK_REALTIME).is_ok());
Expand All @@ -32,7 +32,7 @@ pub fn test_clock_getcpuclockid() {
assert!(clock_gettime(clock_id).is_ok());
}

#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
#[cfg(not(target_os = "redox"))]
#[test]
pub fn test_clock_id_res() {
assert!(ClockId::CLOCK_REALTIME.res().is_ok());
Expand Down

0 comments on commit 599ac91

Please sign in to comment.