Answer architecture round 1: 1 🔴, 2 🟡 (0 misread); render the stamp through Effects.local_time
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
from loop_claude.effects import Effects
|
||||
|
||||
|
||||
# The spelling `YYYY-MM-DD HH:MM:SS` in local time, never UTC, is lilleman's call of 2026-10-28.
|
||||
# The spelling `YYYY-MM-DD HH:MM:SS` in local time, never UTC, is lilleman's call of 2026-10-28; Effects.local_time renders it.
|
||||
def say(text: str, effects: Effects, *, stdout: bool = False) -> None:
|
||||
"""Prints text on stderr, or on stdout where stdout, opening its first line with the machine's local time as `2026-10-28 11:46:01`, so the human sees when it happened. Blank lines before the text stay blank, and only its first line gets the time."""
|
||||
"""Prints text on stderr, or on stdout where stdout, opening its first line with the machine's local time, so the human sees when it happened. Blank lines before the text stay blank, and only its first line gets the time."""
|
||||
body = text.lstrip("\n")
|
||||
blanks = text[: len(text) - len(body)]
|
||||
stamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(effects.now()))
|
||||
print(f"{blanks}{stamp} {body}", file=sys.stdout if stdout else sys.stderr, flush=True)
|
||||
print(f"{blanks}{effects.local_time(effects.now())} {body}", file=sys.stdout if stdout else sys.stderr, flush=True)
|
||||
|
||||
Reference in New Issue
Block a user