diff --git a/Cargo.toml b/Cargo.toml index 5a88589..e26a900 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shadow-rs" -version = "0.6.0" +version = "0.6.2" authors = ["baoyachi "] edition = "2018" description = "A build-time information stored in your rust project" diff --git a/README.md b/README.md index 7de73bc..7cf1278 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ with [`clap`](https://github.com/baoyachi/shadow-rs/blob/master/example_shadow/s | PROJECT_NAME | shadow-rs | | BUILD_TIME | 2021-06-24 21:33:59 | | BUILD_TIME_2822 | Thu, 24 Jun 2021 21:33:59 +0800 | -| BUILD_TIME_3339 | 2021-06-24T21:33:59.972494+08:00 | +| BUILD_TIME_3339 | 2021-06-24T15:53:55+08:00 | | BUILD_RUST_CHANNEL | debug/release | If you have any questions, please create an [issue](https://github.com/baoyachi/shadow-rs/issues/new) so we may improve diff --git a/src/env.rs b/src/env.rs index e0af23d..2aecd3f 100644 --- a/src/env.rs +++ b/src/env.rs @@ -2,7 +2,7 @@ use crate::build::*; use crate::channel::*; use crate::err::SdResult; -use chrono::Local; +use chrono::{Local, SecondsFormat}; use std::env; use std::process::Command; @@ -272,7 +272,7 @@ pub fn build_time(project: &mut Project) { BUILD_TIME_3339, ConstVal { desc: "display project build time by rfc3399".to_string(), - v: time.to_rfc3339(), + v: time.to_rfc3339_opts(SecondsFormat::Secs, true), t: ConstType::Str, }, ); diff --git a/src/git.rs b/src/git.rs index 9fa8f03..c8590ec 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,6 +1,7 @@ use crate::build::{ConstType, ConstVal, ShadowConst}; use crate::ci::CiType; use crate::err::*; +use chrono::SecondsFormat; use std::collections::HashMap; use std::path::Path; use std::process::Command; @@ -95,7 +96,10 @@ impl Git { self.update_val(COMMIT_DATE_2822, date_time.to_rfc2822()); - self.update_val(COMMIT_DATE_3339, date_time.to_rfc3339()); + self.update_val( + COMMIT_DATE_3339, + date_time.to_rfc3339_opts(SecondsFormat::Secs, true), + ); let author = commit.author(); if let Some(v) = author.email() { diff --git a/src/lib.rs b/src/lib.rs index f55bd93..246ecc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ //! pub const COMMIT_AUTHOR :&str = "baoyachi"; //! pub const BUILD_TIME :&str = "2020-08-16 13:48:52"; //! pub const BUILD_TIME_2822 :&str = "Thu, 24 Jun 2021 21:44:14 +0800"; -//! pub const BUILD_TIME_3339 :&str = "2021-06-24T21:44:14.473058+08:00"; +//! pub const BUILD_TIME_3339 :&str = "2021-06-24T15:53:55+08:00"; //! pub const COMMIT_DATE :&str = "2020-08-16 13:12:52"; //! pub const COMMIT_DATE_2822 :&str = "Thu, 24 Jun 2021 21:44:14 +0800"; //! pub const COMMIT_DATE_3339 :&str = "2021-06-24T21:44:14.473058+08:00";