Skip to content

Commit 2a8e44b

Browse files
committed
Add more details to build date
1 parent a4dd079 commit 2a8e44b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,30 @@ fn write_dependencies(manifest_location: &path::Path, w: &mut fs::File) -> io::R
627627

628628
#[cfg(feature = "chrono")]
629629
fn write_time(w: &mut fs::File) -> io::Result<()> {
630+
use chrono::Datelike;
631+
630632
let now = chrono::offset::Utc::now();
633+
write_variable!(
634+
w,
635+
"BUILT_TIME_YEAR",
636+
"i32",
637+
now.year(),
638+
"The build time year, UTC."
639+
);
640+
write_variable!(
641+
w,
642+
"BUILT_TIME_MONTH",
643+
"u32",
644+
now.month(),
645+
"The build time month, UTC."
646+
);
647+
write_variable!(
648+
w,
649+
"BUILT_TIME_DAY",
650+
"u32",
651+
now.day(),
652+
"The build time day, UTC."
653+
);
631654
write_str_variable!(
632655
w,
633656
"BUILT_TIME_UTC",

0 commit comments

Comments
 (0)