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 {
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());

View file

@ -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

View file

@ -15,17 +15,13 @@ pub fn from_secs(secs: i64) -> DateTime<Utc> {
DateTime::<Utc>::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<Utc>` 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 {