Loading _docs/source-date-epoch.md +10 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,16 @@ sys.env.get("SOURCE_DATE_EPOCH") Using the `chrono` crate: ```rust use chrono::{TimeZone, Utc}; use std::env; let now = match env::var("SOURCE_DATE_EPOCH") { Ok(val) => { Utc.timestamp_opt(val.parse::<i64>().unwrap(), 0).unwrap() } Err(_) => Utc::now(), }; ``` or ```rust use chrono::{DateTime, NaiveDateTime, Utc}; use std::env; Loading Loading
_docs/source-date-epoch.md +10 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,16 @@ sys.env.get("SOURCE_DATE_EPOCH") Using the `chrono` crate: ```rust use chrono::{TimeZone, Utc}; use std::env; let now = match env::var("SOURCE_DATE_EPOCH") { Ok(val) => { Utc.timestamp_opt(val.parse::<i64>().unwrap(), 0).unwrap() } Err(_) => Utc::now(), }; ``` or ```rust use chrono::{DateTime, NaiveDateTime, Utc}; use std::env; Loading