mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
BaseChatMesh::bootstrapRTCfromContacts() called setCurrentTime(latest+1) unconditionally. The newest contact's lastmod proves the clock must be at *least* that late -- it says nothing about it being any earlier -- so on any node that already has a better time source (a board with a real RTC, or the Emscripten sim whose SimRTCClock is backed by the host's wall clock) this dragged a correct clock backwards to whatever timestamp happened to be persisted alongside the contact list. Measured in the sim: ~9s behind real time after every reboot, growing with how long the previous session ran. Also adds sim_test_sync_time(epoch_secs) next to the other SIM_PLATFORM/__EMSCRIPTEN__ test hooks, so a host page can re-anchor the RTC on every (re)boot. The clock is live state the real mesh writes to at runtime -- a peer whose own clock runs ahead pushes ours forward, which is right on a node with no better source and, with meshcore-solo-site's cross-visitor relay, means one skewed visitor can drag everyone. On a demo running on someone's computer, "reset the device" should also mean "the clock is correct again". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018iubftDmKNWmkNnhJRz8UH