From f4f11b78ada9d3200d91fa6a67f57616b0479b03 Mon Sep 17 00:00:00 2001 From: Damocles Date: Fri, 1 May 2026 12:59:07 +0200 Subject: [PATCH] include current wall clock in matrix_turn envelope --- src/claude.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/claude.rs b/src/claude.rs index c9d4d11..6e09cc8 100644 --- a/src/claude.rs +++ b/src/claude.rs @@ -103,6 +103,10 @@ The room_id and other fields are explicit - use them in your tool calls."; struct MatrixTurn { #[serde(rename = "type")] kind: &'static str, + /// Current wall clock at turn-build time (unix seconds). + now: i64, + /// Current wall clock formatted YYYY-MM-DD HH:MM UTC. + now_human: String, room_id: String, room_name: String, room_notes_path: String, @@ -137,8 +141,15 @@ fn build_turn( .map(|i| wire_event_from(i, read_markers)) .collect(); + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_secs() as i64) + .unwrap_or(0); + MatrixTurn { kind: "matrix_turn", + now, + now_human: format!("{} UTC", format_ts(now)), room_id: source_room.as_str().to_owned(), room_name: room_name.to_owned(), room_notes_path: format!("../rooms/{source_room}/notes.md"),