encap dep:chrono in time utils
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -49,6 +49,7 @@ sentry_telemetry = []
|
||||
argon2.workspace = true
|
||||
axum.workspace = true
|
||||
bytes.workspace = true
|
||||
chrono.workspace = true
|
||||
either.workspace = true
|
||||
figment.workspace = true
|
||||
http-body-util.workspace = true
|
||||
|
||||
@@ -9,3 +9,12 @@ pub fn millis_since_unix_epoch() -> u64 {
|
||||
.expect("time is valid")
|
||||
.as_millis() as u64
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn rfc2822_from_seconds(epoch: i64) -> String {
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
DateTime::<Utc>::from_timestamp(epoch, 0)
|
||||
.unwrap_or_default()
|
||||
.to_rfc2822()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user