diff --git a/hive-agent/src/turn.rs b/hive-agent/src/turn.rs index f099d7ab..e6ea396c 100644 --- a/hive-agent/src/turn.rs +++ b/hive-agent/src/turn.rs @@ -416,7 +416,8 @@ fn maybe_auto_reset(bus: &Bus) { if last_ended == 0 { 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() .duration_since(std::time::UNIX_EPOCH) .map_or(0, |d| d.as_secs()); diff --git a/hive-c0re/src/actions.rs b/hive-c0re/src/actions.rs index d3eb90c4..207ecf95 100644 --- a/hive-c0re/src/actions.rs +++ b/hive-c0re/src/actions.rs @@ -714,7 +714,7 @@ fn finish_approval( // Phase 5b: also fire on the dashboard event channel so the // browser moves the row out of pending into history without a // 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. let approval_kind = approval.kind.as_str(); let sha_short = approval diff --git a/hive-sh4re/src/wire_time.rs b/hive-sh4re/src/wire_time.rs index 50850747..661cd78a 100644 --- a/hive-sh4re/src/wire_time.rs +++ b/hive-sh4re/src/wire_time.rs @@ -15,17 +15,13 @@ pub fn from_secs(secs: i64) -> DateTime { DateTime::::from_timestamp(secs, 0).unwrap_or_default() } -/// Current unix timestamp in seconds — the single definition behind -/// every store's `created_at` / `sent_at` / … stamp (this module owns -/// the epoch-seconds convention; a dozen local copies of this fn used -/// to float around both binaries). Uses chrono's `clock` feature -/// (already pulled in workspace-wide) instead of hand-rolled -/// `SystemTime` math, consistent with every other timestamp in this -/// module being a `chrono` type. -#[must_use] -pub fn now_unix() -> i64 { - Utc::now().timestamp() -} +// `now_unix()` (a hand-rolled-`SystemTime`-math-turned-`chrono` helper +// that every store used to call for its `created_at` / `sent_at` / … +// stamps) has been removed — every call site now uses +// `chrono::Utc::now()` directly, either as a `DateTime` struct +// field or via `.timestamp()` for the ephemeral i64-typed (sqlite +// bind / cutoff arithmetic) call sites. hivectl's own separate +// `now_unix()` copy in `dag_progress.rs` is unrelated and untouched. #[cfg(test)] mod tests {