diff --git a/src/lib.rs b/src/lib.rs index 031343e..7a9aa7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,6 +54,7 @@ use std::ops::MulAssign; use std::ops::Sub; use std::ops::SubAssign; use std::str::FromStr; +use std::time::SystemTime; use chrono::format::DelayedFormat; use chrono::format::StrftimeItems; @@ -167,12 +168,12 @@ impl Time { .map(|chrono_datetime| Time::millis(chrono_datetime.timestamp_millis())) } - /// Returns the current time instance. + /// Returns the current time instance based on `SystemTime` /// /// Don't use this method to compare if the current time has passed a /// certain deadline. pub fn now() -> Time { - Time::millis(chrono::Local::now().timestamp_millis()) + Time::from(SystemTime::now()) } pub fn as_millis(&self) -> i64 { @@ -332,6 +333,18 @@ impl From