Debian Codegraph @

debian/missing-sources/libc/src/new/qurt/time.rs

raw
1 //! Header: `time.h`
2
3 use super::*;
4 use crate::prelude::*;
5
6 // Clock types
7 pub const CLOCK_REALTIME: clockid_t = 0;
8 pub const CLOCK_MONOTONIC: clockid_t = 1;
9 pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
10 pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
11
12 // Timer flags
13 pub const TIMER_ABSTIME: c_int = 1;
14
15 extern "C" {
16 // Time functions
17 pub fn time(tloc: *mut time_t) -> time_t;
18 pub fn difftime(time1: time_t, time0: time_t) -> c_double;
19 pub fn mktime(tm: *mut tm) -> time_t;
20 pub fn gmtime(timep: *const time_t) -> *mut tm;
21 pub fn gmtime_r(timep: *const time_t, result: *mut tm) -> *mut tm;
22 pub fn localtime(timep: *const time_t) -> *mut tm;
23 pub fn localtime_r(timep: *const time_t, result: *mut tm) -> *mut tm;
24 pub fn asctime(tm: *const tm) -> *mut c_char;
25 pub fn asctime_r(tm: *const tm, buf: *mut c_char) -> *mut c_char;
26 pub fn ctime(timep: *const time_t) -> *mut c_char;
27 pub fn ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char;
28 pub fn strftime(
29 s: *mut c_char,
30 maxsize: size_t,
31 format: *const c_char,
32 timeptr: *const tm,
33 ) -> size_t;
34
35 // High-resolution time functions
36 pub fn clock_gettime(clk_id: clockid_t, tp: *mut timespec) -> c_int;
37 pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) -> c_int;
38 pub fn clock_getres(clk_id: clockid_t, res: *mut timespec) -> c_int;
39 pub fn nanosleep(req: *const timespec, rem: *mut timespec) -> c_int;
40
41 // Timer functions
42 pub fn timer_create(clockid: clockid_t, sevp: *mut sigevent, timerid: *mut timer_t) -> c_int;
43 pub fn timer_delete(timerid: timer_t) -> c_int;
44 pub fn timer_settime(
45 timerid: timer_t,
46 flags: c_int,
47 new_value: *const itimerspec,
48 old_value: *mut itimerspec,
49 ) -> c_int;
50 pub fn timer_gettime(timerid: timer_t, curr_value: *mut itimerspec) -> c_int;
51 pub fn timer_getoverrun(timerid: timer_t) -> c_int;
52 }