Skip to content

Commit 3122dbf

Browse files
committed
refactor: deprecated function updated and unused import deleted
1 parent 4167b86 commit 3122dbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/clock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use chrono::{DateTime, Duration, Utc};
1+
use chrono::{DateTime, TimeDelta, Utc};
22

33
pub const DATETIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S";
44

@@ -16,7 +16,7 @@ pub fn now() -> u64 {
1616
/// Returns the datetime some seconds ago.
1717
#[must_use]
1818
pub fn seconds_ago_utc(seconds: i64) -> DateTime<chrono::Utc> {
19-
Utc::now() - Duration::seconds(seconds)
19+
Utc::now() - TimeDelta::try_seconds(seconds).expect("too little or too many seconds")
2020
}
2121

2222
/// Returns the current time in database format.

0 commit comments

Comments
 (0)