refactor: single now_unix in hive_sh4re::wire_time
replaces 15 per-module copies (now_unix/now_secs) across hive-c0re and hive-ag3nt; wire_time already owns the epoch-seconds convention
This commit is contained in:
parent
d190420946
commit
c84028ddcf
16 changed files with 45 additions and 125 deletions
|
|
@ -15,9 +15,10 @@
|
|||
//! the honest fix is to clean them up where they live.
|
||||
|
||||
use std::path::Path;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use std::time::Duration;
|
||||
|
||||
use rusqlite::{Connection, Result, params};
|
||||
use hive_sh4re::wire_time::now_unix;
|
||||
|
||||
/// How often the sweep runs.
|
||||
const VACUUM_INTERVAL: Duration = Duration::from_hours(1);
|
||||
|
|
@ -131,10 +132,3 @@ fn vacuum_events(path: &Path) -> Result<u64> {
|
|||
Ok(u64::try_from(removed).unwrap_or(0))
|
||||
}
|
||||
|
||||
fn now_unix() -> i64 {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.ok()
|
||||
.and_then(|d| i64::try_from(d.as_secs()).ok())
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue