I'm about to start a project using the MKR Zero with an MKR GPS Shield, but I have a question about the getTime() class. The documentation says it returns "epoch time" which I guess is the number of seconds since January 5, 1980 (rather than Unix epoch time). But is this GPS epoch time adjusted for leap seconds? If not, I have a challenge making the 19 or 20-second adjustment depending on what year it is currently.
The reason this is important is that my project involves anticipating a top-of-the-minute or bottom-of-the-minute starting time for a race (i.e., starting a timer and other functions at the next 30-second mark after an interrupt from a pushbutton).
Hi wildbill, Thanks for the prompt reply. Your suggestion is exactly what I would do if I had the MKR GPS shield, but I don't yet have it, so I was hoping to get a head start on the problem. I do have the Adafruit GPS module, and it gives me the actual time in hours, minutes, and seconds, but the library for the MKR GPS doesn't seem to do that. Anyway, thanks again. I'll try to keep this updated with whatever I discover.
The GPS does indeed get the updated\current value of leap seconds from the GPS satellites.
Unfortunatly the updated value is in a navigation message which only goes out every 12.5 minutes.
So the 'actual' time reported by the GPS can be out some seconds until this navigation message is received.
Thus if the GPS reported time needs to be up to date, then you have to check that the leap seconds update has actually been received, rather than just assuming it has.
It looks like the usual ublox GPS module. I'd guess therefore that it will provide a leap second adjusted time and I certainly wouldn't worry about it until it was proved I had to. Worth checking the instant you have it in your hands of course.
Hey srnet and wildbill - Many thanks for the information and insights! I'll keep my fingers crossed about getting the correct time from the MKR GPS when I test it out.
I got the MKR Zero and MKR GPS Shield. The MKR GPS had such a hard time acquiring a fix that I had to abandon that unit (imagine being at the start line for a race and your race computer is waiting forever for a GPS signal...). I'm using the Adafruit Ultimate GPS Breakout instead, and it gives correct time (hours, minutes, seconds). So, while I assume the MKR GPS Shield handles leap seconds, I never really tested it. Thanks for all your insights and help.