Skip to content

Send NSPanels the POSIX TZ rule for the manager's timezone - #405

Merged
tpanajott merged 2 commits into
NSPManager:develfrom
jamesmulcahy:feat/manager-tz-posix
Oct 19, 2026
Merged

tpanajott merged 2 commits into
NSPManager:develfrom
jamesmulcahy:feat/manager-tz-posix

Conversation

@jamesmulcahy

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #402. This lets a panel render local time from its own clock, once it has been given the time by #404. No user configuration is needed: the manager works out the rule from the timezone it already runs in.

  • New NSPanelConfig.tz_posix (field 46). It holds the POSIX TZ rule for the manager's timezone, e.g. CET-1CEST,M3.5.0,M10.5.0/3, ready for setenv("TZ", ...) and tzset() on the panel. It is empty if the manager couldn't work it out, in which case panels keep showing status/time as they do today.
  • On load, the manager reads the rule from the end of /usr/share/zoneinfo/<zone>, using the zone it already reads from /etc/timezone. Version 2 and later tzdata files end with this rule (RFC 8536, section 3.3). Version 1 files, missing files and files with an empty rule give an empty string.
  • The C++ protobuf was regenerated with protoc 27.0, the same version as the checked-in files: regenerating the unchanged proto reproduces them byte for byte. The firmware's protobuf-c files are left to the firmware PR, as in Send per-event buzzer sounds to panels in NSPanelConfig #394.
  • The parser agrees with tail -n1 on all 447 zones in tzdata 2025b.

Independent of #403 and #404.

Known gaps, deliberately not handled

  • America/Nuuk, Asia/Jerusalem and America/Santiago use version 3 rule extensions (a negative hour, or hours of 24 and above). Whether newlib's tzset() accepts them still has to be checked on a panel.
  • Africa/Casablanca's rule is an approximation that is wrong during Ramadan.

In both cases the manager's status/time topics are still there to fall back on.

🤖 Generated with Claude Code

The manager reads the rule from the end of the configured zone's tzdata
file and sends it in NSPanelConfig.tz_posix, so a panel can render local
time from its own clock with setenv("TZ") and tzset(). Empty if the rule
could not be read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamesmulcahy
jamesmulcahy marked this pull request as ready for review October 17, 2026 21:08
A failure to read the tzdata file should only mean panels fall back to the
manager's time, never break loading the config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tpanajott
tpanajott merged commit 253cb27 into NSPManager:devel Oct 19, 2026
1 check passed
jamesmulcahy added a commit to jamesmulcahy/NSPanelManager that referenced this pull request Oct 21, 2026
NSPManager#405 added NSPanelConfig.tz_posix to protobuf_nspanel.proto and
regenerated the MQTTManager C++ code, but not the protobuf-c code the
firmware builds against. Taken from the protobuf check's output, so it
is exactly what CI generates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesmulcahy added a commit to jamesmulcahy/NSPanelManager that referenced this pull request Oct 21, 2026
Three .proto changes regenerated the MQTTManager C++ code but not the
protobuf-c code in protobuf_firmware/ that the firmware builds against:

- NSPManager#385 added volume_step to NSPanelEntityState.MediaPlayer
- NSPManager#394 added the Sound message and NSPanelConfig.sounds
- NSPManager#405 added NSPanelConfig.tz_posix

The protobuf check added later in this series caught all three.
Generated with protoc 27.0 and protoc-gen-c 1.4.1, as CI does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesmulcahy added a commit to jamesmulcahy/NSPanelManager that referenced this pull request Oct 22, 2026
Two .proto changes regenerated the MQTTManager C++ code but not the
protobuf-c code in protobuf_firmware/ that the firmware builds against:

- NSPManager#394 added the Sound message and NSPanelConfig.sounds
- NSPManager#405 added NSPanelConfig.tz_posix

The protobuf check added later in this series caught both.
Generated with protoc 27.0 and protoc-gen-c 1.4.1, as CI does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants