My GPS is reporting dates from the previous epoch. How many microseconds should I add to the date to get the correct value?
Since the 2019 GPS Week Number Rollover, my old GPS logger (QStarz BT-Q1000X) has started reporting that the current GPS date is in 1999. I think I can fix it by re-writing the logging software to add a constant value to the timestamps. But what constant? The software is written in Java, which measures time as the number of microseconds since midnight at the start of 1 Jan 1970, so I need a value in microseconds.
From the answer to What is a GPS epoch? I understand that GPS time is measured in weeks and seconds from 6 Jan 1980. In this sense, the length of the GPS epoch is the time taken for the week number to roll over. This is 1024 weeks (as it is stored as a 10-bit number) or about 19.7 years. Hence the second GPS epoch started on 22 August 1999, and the third on 7 April 2019.
The simple calculation is that I should add on 1024 weeks * 7 days * 24 hours * 60 minutes * 60 seconds * 1000 = 619 315 200 000 ms. But is this right? Do I need to account for leap seconds, non-integer numbers of weeks/year or hours/day, etc? In short, is there anything else non-obvious I need to take into account?
For my application, I don't need accuracy better than to the nearest second, and I realise that there is a difference between GPS time and UTC. What I'm after is values that are reasonably accurate with respect to current GPS time.
More relevant background: