From ba00530caf7db25f75b106cef60d376eabfc8cee Mon Sep 17 00:00:00 2001 From: serversdown Date: Sat, 27 Jun 2026 05:47:27 +0000 Subject: [PATCH] fix: report time in Brian's local timezone, not UTC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clock.stamp() (injected into her chat prompt via _now_note, and into reflection) rendered UTC and ignored the configured timezone, so 'what time is it' answered in UTC — hours off from his actual time, reading as 'she doesn't know the time'. Now converts to config.timezone (America/New_York -> EDT/EST), UTC fallback if the zone can't load. Storage stays UTC; this only changes what she reads. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyra/clock.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lyra/clock.py b/lyra/clock.py index 4da25c5..9a2d5b8 100644 --- a/lyra/clock.py +++ b/lyra/clock.py @@ -9,20 +9,33 @@ a long silence *means* to her is left to her own reflection, not prescribed here from __future__ import annotations from datetime import datetime, timezone +from zoneinfo import ZoneInfo + +from lyra import config def now() -> datetime: return datetime.now(timezone.utc) +def _local_tz() -> ZoneInfo | timezone: + """Brian's configured local zone (falls back to UTC if it can't be loaded).""" + try: + return ZoneInfo(config.load().timezone) + except Exception: + return timezone.utc + + def _parse(iso: str) -> datetime: dt = datetime.fromisoformat(iso) return dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc) def stamp(dt: datetime | None = None) -> str: - """Wall-clock stamp, e.g. 'Wednesday, 17 Jun 2026, 01:50 UTC'.""" - return (dt or now()).strftime("%A, %d %b %Y, %H:%M UTC") + """Wall-clock stamp in Brian's local timezone, e.g. + 'Friday, 27 Jun 2026, 01:50 EDT'. Times are stored UTC; this is what she *reads*, + so 'what time is it' answers in his time, not UTC.""" + return (dt or now()).astimezone(_local_tz()).strftime("%A, %d %b %Y, %H:%M %Z") def gap_seconds(since_iso: str | None, ref: datetime | None = None) -> float | None: