Skip to content

firru.times: journalctl-style times with named windows; the LSPR24 example takes them - #9

Merged
ppietikainen merged 1 commit into
mainfrom
times
Nov 19, 2026
Merged

ppietikainen merged 1 commit into
mainfrom
times

Conversation

@ppietikainen

Copy link
Copy Markdown
Member

firru.times parses the times journalctl --since/--until takes (systemd.time(7)), plus named windows, so a command can say --since "day1 09:00" instead of an epoch or an ISO string.

  • Forms: now, today/yesterday/tomorrow, a bare HH:MM, a day followed by a time, anything datetime.fromisoformat reads, relative times (-30min, 1h 30min ago), and a UTC suffix.
  • Named windows stand where journalctl takes today. A name alone is the window's start (its end with end=True), and day0 12:00 is that hour on the window's first day.
  • Zone: a fixed offset, UTC unless one is given, never the machine's zone. Relative times are elapsed time, and now is injected for tests.
  • Errors list the accepted forms, or the known windows when an unknown name precedes a time.

The LSPR24 example uses it:

  • lspr24_to_flows.py and listening_split.py take their windows from one parser at UTC+02.
  • --since/--until replace --start/--end; --window stays.
  • The window used is printed in UTC before any flow.

Checks:

  • Every named window resolves to the same boundaries as the old conversion.
  • On the parquet, --since "d2 09:00" --until "d2 09:01" and the same minute written in UTC select the same 7,702 flows, all inside 07:00–07:01Z.
  • 34 new tests.

Wiring the windows into firru.toml and the other commands comes later; this PR only adds the parser and uses it in the example.

🤖 Generated with Claude Code

TimeParser reads what journalctl's --since/--until take (systemd.time(7)):
now, today/yesterday/tomorrow, a bare HH:MM, a day followed by a time,
anything datetime.fromisoformat reads, relative times (-30min, '1h 30min
ago'), and a ' UTC' suffix. The one addition is named windows, which stand
where journalctl takes `today`: a name is the window's start, or with
end=True its end, and 'day0 12:00' is that hour on its first day.

The zone is a fixed offset, UTC unless given, never the machine's: day
names resolve in it, relative times are elapsed time, and `now` is
injected for tests.

lspr24_to_flows.py and listening_split.py take their windows from one
parser at UTC+02. --since/--until replace --start/--end ('YYYY-MM-DD HH'),
--window stays, and the window used is printed in UTC before any flow.
Every named window resolves to the boundaries the old conversion gave; on
the parquet, `--since "d2 09:00" --until "d2 09:01"` and the same minute
written in UTC select the same 7,702 flows, all inside 07:00-07:01Z.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ppietikainen
ppietikainen merged commit 1723fd7 into main Nov 19, 2026
6 checks passed
@ppietikainen ppietikainen mentioned this pull request Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant