hive-agent: finish chrono-clock migration on remaining call sites

This commit is contained in:
damocles 2026-08-01 23:49:03 +02:00 committed by mara
commit f4a35786b1
10 changed files with 63 additions and 47 deletions

View file

@ -32,7 +32,7 @@ use std::path::Path;
use std::sync::Mutex;
use anyhow::{Context, Result};
use hive_sh4re::wire_time::now_unix;
use chrono::{DateTime, Utc};
use rusqlite::{Connection, params};
const SCHEMA: &str = r"
@ -78,7 +78,7 @@ pub struct QuestionMirror {
pub role: Role,
pub peer: String,
pub question: String,
pub asked_at: i64,
pub asked_at: DateTime<Utc>,
}
/// The harness-local questions mirror. Same sharing/locking shape as
@ -120,7 +120,7 @@ impl Questions {
conn.execute(
"INSERT OR REPLACE INTO questions (id, role, peer, question, asked_at) \
VALUES (?1, ?2, ?3, ?4, ?5)",
params![id, role.as_str(), peer, question, now_unix()],
params![id, role.as_str(), peer, question, Utc::now().timestamp()],
)?;
Ok(())
}
@ -170,12 +170,14 @@ impl Questions {
tracing::warn!(%id, %role_str, "questions mirror: unknown role, skipping row");
continue;
};
let asked_at_secs: i64 = row.get(4)?;
out.push(QuestionMirror {
id,
role,
peer: row.get(2)?,
question: row.get(3)?,
asked_at: row.get(4)?,
asked_at: chrono::DateTime::from_timestamp(asked_at_secs, 0)
.unwrap_or_else(Utc::now),
});
}
Ok(out)