1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub type time64_t = i64;
pub type timeu64_t = u64;

#[repr(C)]
pub struct timespec64_t {
    /// seconds
    pub tv_sec: time64_t,
    /// nanoseconds
    pub tv_nsec: isize,
}

#[repr(C)]
pub struct itimerspec64_t {
    pub it_interval: timespec64_t,
    pub it_value: timespec64_t,
}

/// Parameters used to convert the timespec values:
pub const MSEC_PER_SEC: i64 = 1000;
pub const USEC_PER_MSEC: i64 = 1000;
pub const NSEC_PER_USEC: i64 = 1000;
pub const NSEC_PER_MSEC: i64 = 1000000;
pub const USEC_PER_SEC: i64 = 1000000;
pub const NSEC_PER_SEC: i64 = 1000000000;
pub const FSEC_PER_SEC: i64 = 1000000000000000;

/// Located here for timespec[64]_valid_strict
//#define TIME64_MAX			((s64)~((u64)1 << 63))
//#define KTIME_MAX			((s64)~((u64)1 << 63))
//#define KTIME_SEC_MAX			(KTIME_MAX / NSEC_PER_SEC)
//TODO(Shaohua):

/// Limits for settimeofday():
///
/// To prevent setting the time close to the wraparound point time setting
/// is limited so a reasonable uptime can be accomodated. Uptime of 30 years
/// should be really sufficient, which means the cutoff is 2232. At that
/// point the cutoff is just a small part of the larger problem.
pub const TIME_UPTIME_SEC_MAX: i64 = (30 * 365 * 24 * 3600);
//pub const TIME_SETTOD_SEC_MAX: i64 = 		(KTIME_SEC_MAX - TIME_UPTIME_SEC_MAX);