Skip to content

Commit 68f695d

Browse files
Improve GPS date extraction from GPS messages
1 parent f5e1adc commit 68f695d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/datetools.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ function leapSecondsTAI (year, month) {
1919

2020
export default function extractStartTime (msgs) {
2121
for (const i in msgs.time_boot_ms) {
22-
if (msgs.GWk[i] > 1000) { // lousy validation
22+
if (msgs.GWk[i] > 2000) { // lousy validation
2323
const weeks = msgs.GWk[i]
2424
const ms = msgs.GMS[i]
2525
let d = new Date((315964800.0 + ((60 * 60 * 24 * 7) * weeks) + ms / 1000.0) * 1000.0)
2626
// adjusting for leap seconds
2727
d = new Date(d.getTime() - leapSecondsGPS(d.getUTCFullYear(), d.getUTCMonth() + 1) * 1000)
28+
console.log(d)
2829
return d
2930
}
3031
}

0 commit comments

Comments
 (0)