encap dep:chrono in time utils
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
8cf55c702f
commit
be2d1c722b
5 changed files with 13 additions and 7 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -658,6 +658,7 @@ dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"axum 0.7.5",
|
"axum 0.7.5",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"chrono",
|
||||||
"either",
|
"either",
|
||||||
"figment",
|
"figment",
|
||||||
"hardened_malloc-rs",
|
"hardened_malloc-rs",
|
||||||
|
@ -693,7 +694,6 @@ dependencies = [
|
||||||
name = "conduit_database"
|
name = "conduit_database"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
|
||||||
"conduit_core",
|
"conduit_core",
|
||||||
"log",
|
"log",
|
||||||
"ruma",
|
"ruma",
|
||||||
|
|
|
@ -49,6 +49,7 @@ sentry_telemetry = []
|
||||||
argon2.workspace = true
|
argon2.workspace = true
|
||||||
axum.workspace = true
|
axum.workspace = true
|
||||||
bytes.workspace = true
|
bytes.workspace = true
|
||||||
|
chrono.workspace = true
|
||||||
either.workspace = true
|
either.workspace = true
|
||||||
figment.workspace = true
|
figment.workspace = true
|
||||||
http-body-util.workspace = true
|
http-body-util.workspace = true
|
||||||
|
|
|
@ -9,3 +9,12 @@ pub fn millis_since_unix_epoch() -> u64 {
|
||||||
.expect("time is valid")
|
.expect("time is valid")
|
||||||
.as_millis() as u64
|
.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()
|
||||||
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ zstd_compression = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono.workspace = true
|
|
||||||
conduit-core.workspace = true
|
conduit-core.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
ruma.workspace = true
|
ruma.workspace = true
|
||||||
|
|
|
@ -4,8 +4,7 @@ use std::{
|
||||||
sync::{atomic::AtomicU32, Arc, Mutex, RwLock},
|
sync::{atomic::AtomicU32, Arc, Mutex, RwLock},
|
||||||
};
|
};
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use conduit::{debug, error, info, utils::time::rfc2822_from_seconds, warn, Result, Server};
|
||||||
use conduit::{debug, error, info, warn, Result, Server};
|
|
||||||
use rocksdb::{
|
use rocksdb::{
|
||||||
backup::{BackupEngine, BackupEngineOptions},
|
backup::{BackupEngine, BackupEngineOptions},
|
||||||
perf::get_memory_usage_stats,
|
perf::get_memory_usage_stats,
|
||||||
|
@ -211,9 +210,7 @@ impl Engine {
|
||||||
res,
|
res,
|
||||||
"#{} {}: {} bytes, {} files",
|
"#{} {}: {} bytes, {} files",
|
||||||
info.backup_id,
|
info.backup_id,
|
||||||
DateTime::<Utc>::from_timestamp(info.timestamp, 0)
|
rfc2822_from_seconds(info.timestamp),
|
||||||
.unwrap_or_default()
|
|
||||||
.to_rfc2822(),
|
|
||||||
info.size,
|
info.size,
|
||||||
info.num_files,
|
info.num_files,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue