mirror of
https://github.com/ducaale/xh.git
synced 2025-05-05 15:32:50 +00:00
Merge pull request #402 from nc7s/reproducible-timestamp
Generate man page with reproducible timestamp
This commit is contained in:
commit
f75d09216f
@ -182,7 +182,12 @@ fn generate_manpages(app: &mut clap::Command) {
|
||||
let mut manpage = MAN_TEMPLATE.to_string();
|
||||
|
||||
let current_date = {
|
||||
let (year, month, day) = DateTime::now_utc().date().to_calendar_date();
|
||||
// https://reproducible-builds.org/docs/source-date-epoch/
|
||||
let now = match std::env::var("SOURCE_DATE_EPOCH") {
|
||||
Ok(val) => DateTime::from_unix_timestamp(val.parse::<i64>().unwrap()).unwrap(),
|
||||
Err(_) => DateTime::now_utc(),
|
||||
};
|
||||
let (year, month, day) = now.date().to_calendar_date();
|
||||
format!("{}-{:02}-{:02}", year, u8::from(month), day)
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user