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
46
47
48
49
50
51
use std::time::{Duration, SystemTime};
#[derive(Clone, Debug)]
pub struct BuildStamp {
pub git_revision: &'static str,
pub git_revision_cleanness: &'static str,
pub git_clean: bool,
pub git_status: &'static str,
pub build_time_seconds: u64,
pub build_time_nanos: u64,
}
impl BuildStamp {
pub const fn git_revision(&self) -> &'static str {
self.git_revision
}
pub const fn git_clean(&self) -> bool {
self.git_clean
}
pub const fn git_revision_cleanness(&self) -> &'static str {
self.git_revision_cleanness
}
pub const fn git_status(&self) -> &'static str {
self.git_status
}
pub fn build_time(&self) -> SystemTime {
SystemTime::UNIX_EPOCH
+ Duration::from_secs(self.build_time_seconds)
+ Duration::from_nanos(self.build_time_nanos)
}
}