Skip to main content

relibc/header/time/
constants.rs

1use crate::platform::types::{c_char, c_int, c_long, clockid_t};
2
3#[cfg(target_os = "linux")]
4#[path = "linux.rs"]
5pub mod sys;
6
7#[cfg(target_os = "redox")]
8#[path = "redox.rs"]
9pub mod sys;
10
11pub use self::sys::*;
12
13/// cbindgen:ignore
14pub(crate) const UTC: *const c_char = c"UTC".as_ptr().cast();
15
16/// cbindgen:ignore
17pub(crate) const DAY_NAMES: [&str; 7] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
18/// cbindgen:ignore
19pub(crate) const MON_NAMES: [&str; 12] = [
20    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
21];
22
23pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
24// Can't be time_t because cbindgen UGH
25pub const CLOCKS_PER_SEC: c_long = 1_000_000;
26
27pub const TIMER_ABSTIME: c_int = 1;
28
29// Constants for timespec_get and timespec_getres which are C23 analogues to
30// clock_gettime/getres.
31// The values are offset by one for simplicity since zero represents an error.
32
33/// `TIME_UTC` returns the time since the Unix epoch.
34pub const TIME_UTC: c_int = CLOCK_REALTIME + 1;
35/// `TIME_MONOTONIC` returns the time from the monotonically increasing clock.
36pub const TIME_MONOTONIC: c_int = CLOCK_MONOTONIC + 1;