-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix millis() rollover in deadline, interval, and timestamp handling
#11291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NomDeTom
wants to merge
44
commits into
meshtastic:develop
Choose a base branch
from
NomDeTom:time-handling
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
f1662dd
Add native test coverage for the UptimeClock monotonic seam
NomDeTom 5cf08ff
NextHopRouter: fix 49.7-day millis() rollover in retransmission timing
nightjoker7 96bdbcc
Address Copilot review: use unsigned half-range for rollover-safe ret…
nightjoker7 8851c2c
Use monotonic time for airtime windows
h3lix1 e8cfcfd
Document monotonic airtime windows
h3lix1 43d02f1
Fix test_packet_signing sentinel that #10227's rollover fix inverts
NomDeTom 88ba4de
Make Throttle time-injectable and add hasElapsed()
NomDeTom be2c189
Stop disarmed deadline sentinels reaching the comparison
NomDeTom a5d2d01
Fix millis() rollover in every deadline and interval comparison
NomDeTom da985d7
Remove getMillis64() and use Throttle for the NodeInfo reply window
NomDeTom 65b5495
Add CI guard and docs rule against naive millis() comparisons
NomDeTom 5ed6004
Trim rollover comments to what the code needs
NomDeTom e497326
possible fixes
NomDeTom f0eab22
Address review feedback on the rollover fixes
NomDeTom def6674
Correct the described failure window of a naive millis() compare
NomDeTom 2c518b7
Restore a monotonic uptime clock and consolidate the wrap counters
NomDeTom 0f45a23
Anchor the wall clock in monotonic milliseconds
NomDeTom fa961e3
Stamp the rx_time placeholder in monotonic uptime seconds
NomDeTom 7f3aaab
Date nodes heard before the clock arrives, without polluting last_heard
NomDeTom ec195fd
Update the agent docs for the monotonic timebase
NomDeTom 6a4f664
Publish the monotonic wrap carry from a single writer
NomDeTom 57c239a
Re-arm the GPS ephemeris hold when none is in force
NomDeTom fe534cb
Date the NodeInfo reply window in uptime seconds
NomDeTom 95a3d82
Update the agent docs for the single-writer clock and sentinel direction
NomDeTom 6e53096
Name the fix-hold expiry predicate and arm it from the injected clock
NomDeTom ef30fac
Share the extend formula between the clock's reader and writer
NomDeTom 4a86a40
Trim the NodeInfo dedup comment to the house limit
NomDeTom 6be3e73
todo note for potential future imrpovments
NomDeTom 5ccadaf
fix some simple deadlines
NomDeTom 2220450
Trim the hold-expiry test comment to the house limit
NomDeTom 08be641
Fix non-blocking uptime publication and pre-clock recency edges (#29)
RCGV1 72e1f46
Init the eviction sentinel to the newest possible recency
NomDeTom d226216
Keep the deadline-guard check name branch protection matches
NomDeTom 4148666
Correct native-suite-count to 47 after the develop merge
NomDeTom f116ea6
test(uptime): make the wrap fall where the comment says it does
NomDeTom 9735585
Respond to human comments
NomDeTom f17b226
Did I ever tell you about the time I went to Shelbyville? I wore an o…
NomDeTom f8974bf
Merge branch 'develop' into time-handling
NomDeTom c348a82
Merge branch 'develop' into time-handling
caveman99 52999da
Convert the I2S nag deadline develop dragged in
NomDeTom bc32cf1
Arm the LittleFS format guard with a flag, not a zero timestamp
NomDeTom 7575a3c
Note the single-thread contract on AirTime
NomDeTom 92cb344
Note the AirTime locking TODO, and tighten the thread note
NomDeTom c24528d
Merge branch 'develop' into time-handling
thebentern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Allowlist for the millis-deadline-check guard in .github/workflows/test_native.yml. | ||
| # | ||
| # That guard rejects comparisons made directly against millis(), because they invert while the | ||
| # deadline sits on the far side of the 32-bit wrap. Use Throttle::deadlinePassed(deadline) or | ||
| # Throttle::hasElapsed(lastEvent, intervalMs) instead - see .github/copilot-instructions.md. | ||
| # | ||
| # Only add a line here when the comparison genuinely is not a deadline test. The usual valid case is | ||
| # an *uptime threshold*: "has the device been up for at least N ms", where there is no stored | ||
| # deadline and no event to measure from. Those still misbehave briefly after a wrap - the threshold | ||
| # is simply re-crossed - which is harmless for boot-holdoff logic and not worth new state. | ||
| # | ||
| # Format: <path><TAB><exact trimmed source line, comments stripped> | ||
| # Line numbers are deliberately absent so edits above an entry do not invalidate it. A `#` comment | ||
| # on the code line is stripped before matching, so do not include one here. | ||
|
|
||
| # Boot holdoff, not a deadline: suppresses a phantom shutdown from floating pins during the first | ||
| # 30s of uptime. Pairs with the buttonPressStartTime > 30000 test on the same line. | ||
| src/input/ButtonThread.cpp if (millis() > 30000 && buttonPressStartTime > 30000 && _longLongPress != INPUT_BROKER_NONE && | ||
|
|
||
| # Boot-window check, not a deadline: draws the custom OEM logo only during the first 10s of uptime, | ||
| # so the ordinary Meshtastic logo is used at shutdown. | ||
| src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp if (millis() < 10 * 1000UL) { |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.