Update the Date in case it's before 2020 due to lapped old GPS.#271
Update the Date in case it's before 2020 due to lapped old GPS.#271htool wants to merge 1 commit intoSignalK:masterfrom
Conversation
|
The only problem I see would be parsing data that was captured before the rollover. For that we could have an environment variable to switch this optionally off, but I guess we'll cross that bridge if somebody needs it. |
|
Agreed. I first tried to fix it further upstream, but that made some tests fail where Date is use to tell age of certain info. |
|
Can I interest you in adding a test for this? see test/129029.js |
|
Thank you for this code! I have the same problem with the old GPS on my boat. |
|
I checked your conversion code an its indeed one day wrong. I think its better to base the calculation on ms, this code works correctly: |
|
I'm not sure the above works. In case the date is corrected, the timestamp will be now() and the data in the packet will remain old and reaches SignalK, right? |
That PGN is system time, so it's whatever the system is set to and is isolated from the GPS week rollover. |
I'm not saying my code is correct, but I don't see how code that adds ms instead of days or weeks would work differently. |
|
BTW, I'm now adding it to signalk-server/packages/streams/canboatjs.js instead of 129029.js to allow a toggle in the interface. |
In case of old GPS, the Date part of the pgn will be < 2020. This corrects that, as this pgn should not give a Date < 2020.