in reply to Re^2: Converting GPS seconds to readable time&date
in thread Converting GPS seconds to readable time&date

Yikes! Found this at leapsecond.com

GPS, Global Positioning System time, is the atomic time scale implemen +ted by the atomic clocks in the GPS ground control stations and the G +PS satellites themselves. GPS time was zero at 0h 6-Jan-1980 and sinc +e it is not perturbed by leap seconds GPS is now ahead of UTC by 15 s +econds.
I'm not sure if your hardware is compensating for this diff and/or if it's just outputting standard UTC and saying it's GPS. You're better off listening to someone more GPS aware than I am (that is if you're really worried about that 15 second gap).

-derby

Replies are listed 'Best First'.
Re^4: Converting GPS seconds to readable time&date
by ikegami (Patriarch) on Jan 11, 2009 at 16:58 UTC
Re^4: Converting GPS seconds to readable time&date
by Anonymous Monk on Jan 11, 2009 at 16:36 UTC
    The easiest way to convert a GPS computed time, that you get from the receiver is to add the number of leap seconds reported by the GPS receiver's alminac. This takes about 20 minutes to get on a cold startup, and a few seconds on a warm one.

    There's really no other foolproof way. I've tried a lot.

    Next, if you want to optimize startup time, and also cope with the 'product on a shelf' problem, you have some alternatives:
    (1) Grab the leap second file from NIST via FTP on startup if the GPS receiver doesn't know yet. This may be faster than waiting for it, and can be cached so that you only grab it every 6 months. Count the number of leap seconds since 1980.
    (2) remember the last number of leap seconds, as well as the data from the GPS receiver that tells you 'pending' leap seconds. If you've not passed a leap second opportunity (December 31 or June 30th), the cache is valid. If you have, and there wasn't one scheduled, the cache is invalid and you have to wait.

    I'm sure there are others, but the really only reliable way to convert the GPS time into UTC is to apply the leap second correction. You'll also want to confirm with the GPS data provider that the data is in GPS seconds, not UTC. Many GPS receivers do output UTC in their default mode of operation.

    Warner

Re^4: Converting GPS seconds to readable time&date
by zentara (Cardinal) on Jan 11, 2009 at 15:33 UTC
    There was a recent show on the Discovery( or maybe History) Channel about GPS time. I guess the satellites are travelling fast enough, that they must take relativistic time dilation into account, or all ground positions would be way off. The satellites are aging more slowly than us on the ground, who are stuck in the muck of earth's gravity.

    I'm not really a human, but I play one on earth Remember How Lucky You Are

      I suspect you have two mistakes in your post. 1) We (not the satelites) age more slowly due to being stuck in the gravity well. 2) "Periodic corrections are performed on the on-board clocks to correct relativistic effects and keep them synchronized with ground clocks." (from GPS Time).

      - tye        

        I guess you are right. Since the GPS satellites are geo-stationary, we move faster on earth, as opposed to normal satellites. There I go thinking again. :-)

        I'm not really a human, but I play one on earth Remember How Lucky You Are
Re^4: Converting GPS seconds to readable time&date
by n3toy (Hermit) on Jan 11, 2009 at 16:31 UTC
    The time displayed on the GPS is not really accurate, depending on what you consider accurate. I think some could be as much as a second or maybe two off. But it will be close enough to compare against www.time.gov to see if it is outputting UTC or GPS time. Also, in the setup menu of your GPS there just may be a field to change from one to the other.
      Not true. If you have a good GPS device that's meant to do time-transfer it should be able to get you within 10-100 microseconds of the correct time. Keeping accurate time is the foundation of the whole GPS system :)

        Indeed. At my prior company, they use GPS clocks for controlling the signalling on their digital networks, which means they expect the time to be accurate so that they can send 1.5 million bits per second and not have to "slip" any bits, which means they expect accuracy on the order of 1 microsecond (and searches show 0.5..1 microsecond accuracy for GPS-based clocks). But that is more about frequency accuracy than about agreement with UTC.

        Some results agree with 10 microsecond accuracy vs UTC. Turning on my GPS (which I hadn't used recently) showed it quite at odds vs my WWV clock. Going to the window so it could sync up with satelites got it to agree with my WWV clock to within a small fraction of a second (just holding them next to each other so I could watch the seconds displayed click along in perfect sync as far as my eyes could tell).

        So, yes, GPS units display accurate "human" time (usually in your selected timezone, not just UTC), not something that is 20 seconds "off" nor something only accurate to within several seconds.

        - tye        

        If you have a good GPS device that's meant to do time-transfer

        I do, and their (I have two, and neither have a display) PPS accuracy is within 20 nanoseconds of UTC (assuming you have accounted for the cable length from the antenna to the device). But the time displayed on a typical handheld consumer GPS for LBS (location based servies) are not "accurate" to that level. (Although some quality handheld GPSs have a PPS (Pulse Per Second) that probably meet the specs you quote.) It is good enough to check against a known source to see if it is outputting UTC or GPS, as per the node I was commenting on.

        The time displayed on a handheld GPS is derived from the processing of C/A code and is "old" by the time the display is updated.

        But you are correct in that time-transfer is the whole foundation behind GPS, and LBS is only an application of the system.

Re^4: Converting GPS seconds to readable time&date
by JavaFan (Canon) on Jan 12, 2009 at 19:02 UTC
    Well, the Unix time system doesn't consider leap seconds either. And since its epoch is at Jan 1, 1970, it is 24 seconds ahead of UTC. (Although, we all presume that our system clocks keep time in UTC...)