Loud clock-drift warnings + NTP offset window flush + GetInfo time fields - #99
Open
moralpriest wants to merge 6 commits into
Open
Loud clock-drift warnings + NTP offset window flush + GetInfo time fields#99moralpriest wants to merge 6 commits into
moralpriest wants to merge 6 commits into
Conversation
- p2p/timecheck: emit CLOCK DRIFT and NTP-unreachable at default log level, once per state change (no --debug needed) - probeClockOnce() runs a synchronous NTP check at P2P_Init so startup prints immediately - --timeisinsync flag unchanged (still disables NTP correction) - GetInfo adds clock_offset_ntp_ms, clock_offset_p2p_ms, time_in_sync - unit tests for once-per-transition reporting
libfaketime and messy RTT trip beevik/ntp Validate() (freshness/dispersion), which we were logging as "Cannot reach NTP". If Query returns a |offset| > 1s, report CLOCK DRIFT instead. Unreachable warnings now include the query error.
derod is one binary per GOOS — print Windows (w32tm / Settings), macOS (Date & Time), or Linux (timedatectl/chrony) instead of Linux-only chrony/timedatectl on every platform.
A 128-sample rolling average kept reporting multi-minute drift for hours after chrony had already stepped the OS clock (in-sync poll is 60-120s). On the drift→sync transition, drop stale samples and seed the average from the live reading so GetInfo/Time() converge immediately.
With intermittent connectivity, successes reset the warn latch and each new failure re-warned — a nag every minute. Gate re-warnings solely on time since the last warning (10 min); successes no longer re-arm it. probeClockOnce now reports the real query error too.
Fill all 128 slots then overwrite the oldest; avg must stay exact.
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
--timeisinsyncsemantics are unchanged. This patch only makes clock problems visible and fixes the reporting pipeline around them:V(1)— invisible without--debug). Re-warns are gated: drift by state change; unreachable by a 10-minute cooldown so intermittent connectivity doesn't nag every minute.globals.Time()and GetInfo converge immediately.w32tm/ Settings), macOS (Date & Time), Linux (timedatectl set-ntp true, chrony) instead of Linux-only advice on every platform.clock_offset_ntp_ms,clock_offset_p2p_ms,time_in_sync— lets node managers/explorers read the daemon's own measurement remotely.Test evidence
go test ./p2p ./rpc ./globalsgreen).date -s '+2 minutes'→ single CLOCK DRIFT banner at default level; GetInfo shows-120001 ms / time_in_sync:false.--timeisinsync; warning fires either way.Compatibility
No changes to consensus logic, flag parsing, or defaults. New GetInfo fields are additive JSON.