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

@ -12,8 +12,8 @@ use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, Ordering};
use std::sync::{Arc, Mutex};
use chrono::Utc;
use hive_claude::TokenUsage;
use hive_sh4re::wire_time::now_unix;
use rusqlite::{Connection, params};
use serde::{Deserialize, Serialize};
use tokio::sync::broadcast;
@ -390,7 +390,7 @@ impl Bus {
tx: Arc::new(tx),
event_seq: Arc::new(AtomicU64::new(0)),
store,
state: Arc::new(Mutex::new((TurnState::Idle, now_unix()))),
state: Arc::new(Mutex::new((TurnState::Idle, Utc::now().timestamp()))),
model: Arc::new(Mutex::new(initial_model)),
effort: Arc::new(Mutex::new(initial_effort)),
last_ctx_usage: Arc::new(Mutex::new(None)),
@ -575,7 +575,7 @@ impl Bus {
*self.last_ctx_usage.lock().unwrap() = Some(ctx);
*self.last_cost_usage.lock().unwrap() = Some(cost);
self.last_turn_ended_unix
.store(now_unix(), Ordering::Relaxed);
.store(Utc::now().timestamp(), Ordering::Relaxed);
self.emit(LiveEvent::TokenUsageChanged { ctx, cost });
}
@ -778,7 +778,7 @@ impl Bus {
if guard.0 == next {
return;
}
*guard = (next, now_unix());
*guard = (next, Utc::now().timestamp());
since = guard.1;
}
self.emit(LiveEvent::TurnStateChanged {
@ -861,7 +861,7 @@ impl Bus {
}
let envelope = BusEvent {
seq: self.next_seq(),
ts: now_unix(),
ts: Utc::now().timestamp(),
event,
};
// Lagged subscribers drop events — fine; the UI is a tail, not a log.