xref: /third_party/rust/crates/rustix/tests/time/dynamic_clocks.rs (revision b8a62b91)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rustix/tests/time/
1#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
2
3use rustix::fd::AsFd;
4use rustix::time::{clock_gettime_dynamic, ClockId, DynamicClockId};
5
6#[test]
7fn test_known_clocks() {
8    clock_gettime_dynamic(DynamicClockId::Known(ClockId::Realtime)).unwrap();
9    clock_gettime_dynamic(DynamicClockId::Known(ClockId::Monotonic)).unwrap();
10}
11
12#[test]
13fn test_dynamic_clocks() {
14    let file = std::fs::File::open("Cargo.toml").unwrap();
15    clock_gettime_dynamic(DynamicClockId::Dynamic(file.as_fd())).unwrap_err();
16}
17
18#[cfg(any(target_os = "android", target_os = "linux"))]
19#[test]
20fn test_conditional_clocks() {
21    let _ = clock_gettime_dynamic(DynamicClockId::Tai);
22}
23

Indexes created Thu Nov 07 10:32:03 CST 2024