fix(heartbeat): inject shared current time context into phase 1

This commit is contained in:
Xubin Ren
2026-03-16 10:52:26 +08:00
committed by Xubin Ren
parent 0dda2b23e6
commit 5d1528a5f3
4 changed files with 17 additions and 25 deletions
+8
View File
@@ -2,6 +2,7 @@
import json
import re
import time
from datetime import datetime
from pathlib import Path
from typing import Any
@@ -33,6 +34,13 @@ def timestamp() -> str:
return datetime.now().isoformat()
def current_time_str() -> str:
"""Human-readable current time with weekday and timezone, e.g. '2026-03-15 22:30 (Saturday) (CST)'."""
now = datetime.now().strftime("%Y-%m-%d %H:%M (%A)")
tz = time.strftime("%Z") or "UTC"
return f"{now} ({tz})"
_UNSAFE_CHARS = re.compile(r'[<>:"/\\|?*]')
def safe_filename(name: str) -> str: