GPS timetravel issue — solved

Well, seems like I haven’t properly blooged about it, so here’s how I cured my GPS USB stick (or gpsd, actually) to tell me it’s still 1993 …

Thanks to a friend of mine, I noticed I haven’t updated the original post; well, to me, the solution was rather plain and simple: remember that I used a cheap ARM device that did not feature a RTC to store current day or time. So, I boot that thing, connect to the internet via 2G/3G/4G and then try to ntpdate into today. Thing is, gpsd is started before that, when the system’s still running with a wall clock of 1970 or something. I noticed that, after I did succeed in connectiong to an ntp server and then (re-) start gpsd, the date I receive is from 2013 — and not 1993 as before. So this seems to be something related to the millenia or whatnot, I didn’t ponder much about it but just put something like “date –set 010100002013” (or whatever the data binary needs to set the date to 2013-01-01) into my /etc/rc.local, and voilá, it works.

After Alexander today asked whether I found a solution, I told him this. He happily said thanks — the hack worked for him on the Raspberry Pi as well ;) — and mentioned a “GPS week number rollover”. Googling a bit, this seems to be exactly the reason for my date of 1993 instead of 2013 before: GPS uses a concept of 10 bit week numbers, with week 0 starting at 1980-01-06 00:00 UTC (Americans, starting a week on Sunday …) and week 1023 ending at 1999-08-21 24:00 UTC. Next week got the number 0 again, now starting on 1999-08-22 00:00 UTC. From what I’ve read, there seems to be nothing in the GPS data set to tell you in which 1024 week cycle you are in, that’s why, I guess, gpsd is cheating by relying at the wall clock to get this information. Between August of 1999 and April of 2013 there’s roughly the same time span as between New Year’s Day of 1980 and July 1993, ~13.6 years ;)

A nice reading from the past on this rollover I found here, and there’s even a note of some GPS device manufacturer that after 1999-08-22, that “the date will remain as it is in 19.6 years ago, but time and positioning operation will function normally” — wonderful, isn’t it ;)

Still I don’t understand why devices manufactured after August 1999 still default to 1980 instead of 1999 — they really shouldn’t, IMO.