Repository navigation
MQTTManager: send NSPanels the current time - #404
Merged
Merged
Conversation
jamesmulcahy
marked this pull request as ready for review
October 17, 2026 21:08
tpanajott
reviewed
Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
publish_time_and_date() moves out of main.cpp unchanged, as ManagerClock::_run_clock_thread(). ManagerClock::start() attaches the MQTT connected callback and starts the thread, so main.cpp makes one call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
STOMP is a full mirror of what is published, so the message goes to STOMP before the connected check rather than only after a successful MQTT send. The return value still means "sent over MQTT". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesmulcahy
force-pushed
the
feat/manager-epoch
branch
from
October 20, 2026 14:33
f8a6592 to
d7567ff
Compare
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Manager side of #402 (option A): the manager tells panels the current time so they can set their own clock with
settimeofday(), for media player progress and the other uses listed in the discussion.The topic
nspanel/mqttmanager_<address>/status/epochcarries Unix time in milliseconds as a decimal string, e.g.1760724061234. It is not retained, so a panel only ever receives a time that was current when it was sent.It is sent:
status/timeandstatus/dateonline, so a panel that has just booted or reconnected doesn't wait up to a minute for a clockPanels must subscribe to it before publishing
online, or they miss that reply. No protobuf changes are needed.Changes
MQTT_Manager::publish_if_connected(topic, make_payload)sends over MQTT only when connected. It never buffers or retries, because a buffered time would be delivered stale after reconnecting. The payload is made after taking the client lock, so it is current when sent. It also drops messages until the backlog after reconnecting has been sent (MQTTManager: don't let new messages overtake ones buffered while disconnected #403).MQTT_Manager::attach_connected_callback()is called at the end of every (re)connect._mirror_to_stomp(), shared by both publish paths. The epoch is mirrored unretained tomqtt/.../status/epochwhether or not MQTT is connected, so web UI subscribers only ever see live values.ManagerClockmodule (include/manager_clock/). It skips sending if the host clock reads earlier than 2025-01-01, such as on a Pi before NTP sync, and warns once until the clock is set.🤖 Generated with Claude Code