[time-nuts] How best to compute local time from GPS
David Forbes
dforbes at dakotacom.net
Tue Mar 25 03:07:22 UTC 2008
O Time Nuts,
I am working feverishly on the software for my new scope clock. This
is a circuit board that drives a 3" oscilloscope tube with a rather
good-looking display of numbers and letters, driven by an HC908 MPU
and a hardware circle-drawing engine. The basic gizmo is shown here:
http://www.cathodecorner.com/sc200c.html
I am writing because I am now coding the GPS receiver interface. I
realize that GPS time is not the same as either UTC or local time,
and I am trying to figure out the best way to deal with this fact.
I have provided a user interface to the clock consisting of a rotary
encoder with built-in pushbutton. This controls a menu stack that
functions well and is quite extensible.
I am using a little Garmin GPS 18 LVC puck receiver, chosen for its
reasonable cost and 1PPS output. I designed the DE9 serial port
connector with extra pins to drive current-limited 5V to the puck and
to receive 1PPS to the CPU's IRQ line.
I have written code to buffer up and parse the GPRMC sentence that
gives time and date and location. Now I need to figure out what to do
with these numbers.
I prefer to have the clock run on GPS or UTC time, then convert to
local time as it displays the time. This makes the code more logical
to write, since everything flows from GPS time.
So...
1 Is there a reasonable way to determine the local time zone from the
GPS sentences?
2. If I have to store the time zone from the user's input, are the
DST calculations reasonably straightforward these days?
3. What weird time zone operations should it support, such as 15
minute local offsets or oddball DST dates?
4. In general, is it better to let the user turn DST on and off or
try to do it automatically? (I live in Arizona, which doesn't worship
DST, so I have no experience in this matter.)
5. Considering that the source code is being provided with the clock,
are any of you fine folks interested in getting one of these gadgets
to see what you can do with it?
I await your reasoned replies.
--
--David Forbes, Tucson, AZ
http://www.cathodecorner.com/
More information about the Time-nuts_lists.febo.com
mailing list