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
41
42
43
44
45
use crate::time::SystemTime;
#[derive(Debug)]
#[allow(clippy::module_name_repetitions)]
pub enum SystemTimeSpec {
SymbolicNow,
Absolute(SystemTime),
}
impl SystemTimeSpec {
#[inline]
pub fn from_std(std: fs_set_times::SystemTimeSpec) -> Self {
match std {
fs_set_times::SystemTimeSpec::SymbolicNow => Self::SymbolicNow,
fs_set_times::SystemTimeSpec::Absolute(time) => {
Self::Absolute(SystemTime::from_std(time))
}
}
}
#[inline]
pub const fn into_std(self) -> fs_set_times::SystemTimeSpec {
match self {
Self::SymbolicNow => fs_set_times::SystemTimeSpec::SymbolicNow,
Self::Absolute(time) => fs_set_times::SystemTimeSpec::Absolute(time.into_std()),
}
}
}
impl From<SystemTime> for SystemTimeSpec {
#[inline]
fn from(time: SystemTime) -> Self {
Self::Absolute(time)
}
}