Skip to main content

c/
types.rs

1// Copyright (c) 2026 Meng Zhuo
2// SPDX-License-Identifier: BSD-3-Clause
3
4// ============================================================
5// C type aliases
6// ============================================================
7
8type SizeT = usize;
9type SSizeT = isize;
10type mode_t = c_uint;
11type TimeT = c_long;
12type ClockT = c_long;
13type wchar_t = c_int;
14type wint_t = c_uint;
15type wctype_t = *const c_int;
16type wctrans_t = *const c_int;
17
18const WEOF: wint_t = 0xffffffff;
19
20#[repr(C)]
21pub struct tm {
22    pub tm_sec: c_int,
23    pub tm_min: c_int,
24    pub tm_hour: c_int,
25    pub tm_mday: c_int,
26    pub tm_mon: c_int,
27    pub tm_year: c_int,
28    pub tm_wday: c_int,
29    pub tm_yday: c_int,
30    pub tm_isdst: c_int,
31    pub tm_gmtoff: c_long,
32    pub tm_zone: *const c_char,
33}
34
35#[repr(C)]
36pub struct timeval {
37    pub tv_sec: TimeT,
38    pub tv_usec: c_long,
39}
40
41#[repr(C)]
42pub struct Timeb {
43    pub time: TimeT,
44    pub millitm: u16,
45    pub timezone: i16,
46    pub dstflag: u16,
47}
48