fix: ignore bad timesources. ignore data that is older than our last good value#19
fix: ignore bad timesources. ignore data that is older than our last good value#19herostrat wants to merge 3 commits intoSignalK:masterfrom
Conversation
tkurki
left a comment
There was a problem hiding this comment.
.....and what do we do with last known good value? Why is it saved?
index.js
Outdated
|
|
||
| const minimumYear = 2026 | ||
|
|
||
| function getDataDir() { |
There was a problem hiding this comment.
We use it to "update" the lower range (I choose 2026) |
| const lastGoodDate = new Date(lastGoodTime) | ||
| if (!Number.isNaN(lastGoodDate.getTime()) && Date.now() < lastGoodDate.getTime()) { | ||
| const useSudoFallback = typeof options.sudo === 'undefined' || options.sudo | ||
| setSystemTime(lastGoodTime, useSudoFallback, 'from last-good time') |
There was a problem hiding this comment.
So this sets the time from last good time on plugin start, right? I don't think that is a good idea, as think of scenario where
- no GPS datetime available
- sk server has been off for a day
- you start sk server
=> time travel to yesterday.
There was a problem hiding this comment.
Ok, thats a good point. I didn't think about this scenario.
Yeah I will change that so it doesn't set the system time but only guards against incoming (older) data.
This way wrong data should be ignored and new incoming good data updates the time to a new good value.
|
It would be great if PR title & description would describe the change on a level that an end user can understand, if possible. I am not perfect in that regard, but i try... |
|
Yeah that's fair, sorry. I wasn't expecting that fast of an review and am currently trying to find a way to test this. |
|
lol, sometimes quick, sometimes takes ages |
This PR adds persistence for the last known good datetime and uses it to guard against bad GPS timestamps.
It also introduces a hard minimum year to prevent obvious time resets.
This "minimum last good time" is stored in the data in the plugin’s data.
This way e.g bad fixes in GPS don't result in bogus data.
should be a fix for #10
and probably #14 also?