hive-sh4re: delete now_unix(), the migration's last call sites are gone

This commit is contained in:
damocles 2026-08-02 02:04:00 +02:00 committed by mara
commit 9f5ce4d941
3 changed files with 10 additions and 13 deletions

View file

@ -416,7 +416,8 @@ fn maybe_auto_reset(bus: &Bus) {
if last_ended == 0 { if last_ended == 0 {
return; // no completed turn yet return; // no completed turn yet
} }
// Compute idle seconds using the same clock as now_unix (unix epoch, i64). // Compute idle seconds using the same clock semantics as elsewhere
// in this crate (unix epoch, i64 seconds via `Utc::now().timestamp()`).
let now = std::time::SystemTime::now() let now = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH) .duration_since(std::time::UNIX_EPOCH)
.map_or(0, |d| d.as_secs()); .map_or(0, |d| d.as_secs());

View file

@ -714,7 +714,7 @@ fn finish_approval(
// Phase 5b: also fire on the dashboard event channel so the // Phase 5b: also fire on the dashboard event channel so the
// browser moves the row out of pending into history without a // browser moves the row out of pending into history without a
// snapshot refetch. `approved` rows that succeed get the // snapshot refetch. `approved` rows that succeed get the
// approval's logged resolved_at indirectly via `now_unix()`; // approval's logged resolved_at indirectly via `Utc::now()`;
// failures already wrote it via mark_failed above. // failures already wrote it via mark_failed above.
let approval_kind = approval.kind.as_str(); let approval_kind = approval.kind.as_str();
let sha_short = approval let sha_short = approval

View file

@ -15,17 +15,13 @@ pub fn from_secs(secs: i64) -> DateTime<Utc> {
DateTime::<Utc>::from_timestamp(secs, 0).unwrap_or_default() DateTime::<Utc>::from_timestamp(secs, 0).unwrap_or_default()
} }
/// Current unix timestamp in seconds — the single definition behind // `now_unix()` (a hand-rolled-`SystemTime`-math-turned-`chrono` helper
/// every store's `created_at` / `sent_at` / … stamp (this module owns // that every store used to call for its `created_at` / `sent_at` / …
/// the epoch-seconds convention; a dozen local copies of this fn used // stamps) has been removed — every call site now uses
/// to float around both binaries). Uses chrono's `clock` feature // `chrono::Utc::now()` directly, either as a `DateTime<Utc>` struct
/// (already pulled in workspace-wide) instead of hand-rolled // field or via `.timestamp()` for the ephemeral i64-typed (sqlite
/// `SystemTime` math, consistent with every other timestamp in this // bind / cutoff arithmetic) call sites. hivectl's own separate
/// module being a `chrono` type. // `now_unix()` copy in `dag_progress.rs` is unrelated and untouched.
#[must_use]
pub fn now_unix() -> i64 {
Utc::now().timestamp()
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {