• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![cfg(not(any(target_os = "redox", target_os = "wasi")))]
2 
3 use rustix::fd::AsFd;
4 use rustix::time::{clock_gettime_dynamic, ClockId, DynamicClockId};
5 
6 #[test]
test_known_clocks()7 fn 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]
test_dynamic_clocks()13 fn 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]
test_conditional_clocks()20 fn test_conditional_clocks() {
21     let _ = clock_gettime_dynamic(DynamicClockId::Tai);
22 }
23