feat(clock): a node with no GPS starts at its build epoch, not in 2024
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df66bc8711
commit
bbd4fbc358
8 files changed
+248
-8
No files matched your search
@@ -8,7 +8,9 @@ class VolatileRTCClock : public mesh::RTCClock {
|
||||
uint64_t accumulator;
|
||||
unsigned long prev_millis;
|
||||
public:
|
||||
VolatileRTCClock() { base_time = 1715770351; accumulator = 0; prev_millis = millis(); } // 15 May 2024, 8:50pm
|
||||
// FIRMWARE_BUILD_EPOCH = compile time when the build is stamped, else upstream's
|
||||
// 15 May 2024 literal. See the define in MeshCore.h for why this matters.
|
||||
VolatileRTCClock() { base_time = FIRMWARE_BUILD_EPOCH; accumulator = 0; prev_millis = millis(); }
|
||||
uint32_t getCurrentTime() override { return base_time + accumulator/1000; }
|
||||
void setCurrentTime(uint32_t time) override { base_time = time; accumulator = 0; prev_millis = millis(); }
|
||||
|
||||
|
||||
Reference in new issue
Block a user