We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4167b86 commit 3122dbfCopy full SHA for 3122dbf
src/utils/clock.rs
@@ -1,4 +1,4 @@
1
-use chrono::{DateTime, Duration, Utc};
+use chrono::{DateTime, TimeDelta, Utc};
2
3
pub const DATETIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
4
@@ -16,7 +16,7 @@ pub fn now() -> u64 {
16
/// Returns the datetime some seconds ago.
17
#[must_use]
18
pub fn seconds_ago_utc(seconds: i64) -> DateTime<chrono::Utc> {
19
- Utc::now() - Duration::seconds(seconds)
+ Utc::now() - TimeDelta::try_seconds(seconds).expect("too little or too many seconds")
20
}
21
22
/// Returns the current time in database format.
0 commit comments