fix: use utc timestamps for mqtt#259
Open
Athemis wants to merge 3 commits into
Open
Conversation
maxious
added a commit
to maxious/meshcore-packet-capture
that referenced
this pull request
Jun 5, 2026
Change `datetime.now().isoformat()` to `datetime.now(timezone.utc).isoformat()` in packet_capture.py (3 call sites: LWT, publish_status, format_packet_data) so all MQTT payloads carry an explicit UTC offset (+00:00). Before: "2026-06-05T12:00:00.123456" (naive, no timezone) After: "2026-06-05T12:00:00.123456+00:00" (timezone-aware UTC) ## Ecosystem alignment This matches the format already used by: - meshcoretomqtt (Cisien/meshcoretomqtt) - pyMC_Repeater (status/raw path) - meshcore-ha (Home Assistant integration, PR meshcore-dev/meshcore-ha#259) ## Consumer compatibility - **LetsMesh.net** (primary consumer): timestamp field is pass-through metadata; the actual MeshCore packet timestamp is decoded from the `raw` hex payload. - **CoreScope** (self-hosted analyzer, v3.8.3+): Go `time.Parse(time.RFC3339)` accepts both `Z` and `+00:00` as zone-aware. Removes "Naive observer clock" warning from CoreScope PR Kpa-clawbot/CoreScope#1480. - **Home Assistant / Node-RED**: ISO 8601 with explicit offset is correctly parsed regardless of host timezone.
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
Why
CoreScope reports and clamps MQTT observer timestamps when they are emitted as zone-less local-time values. Using UTC offset-aware ISO 8601 timestamps prevents consumers from interpreting local time as UTC and applying false clock-skew corrections.
Testing
pytest tests/test_mqtt_timestamps.py -vnpm run buildindocsFixes #258