[ale] LINKS and UTC time vs GPS time, not the same???

Ron Frazier atllinuxenthinfo at c3energy.com
Sun Jan 22 15:45:10 EST 2012


Hi Mike T,

See comments inline.

Also, to whom it may concern, at the bottom are a number of high quality 
links I found related to running NTP and GPS on both Windows and FreeBSD 
and Linux.  Also see other links at the top and bottom of these pages.  
There are also some links to some cool GPS and related hardware.  The 
first few are particularly interesting for Linux users.

Sincerely,

Ron


On 1/20/2012 7:16 AM, mike at trausch.us wrote:
> On 01/19/2012 11:52 PM, Ron Frazier wrote:
>    
>> I've been doing some additional research on computer time keeping and
>> such.  I just read that GPS time does not account for leap seconds (the
>> seconds periodically added to match UTC time with astronomical time).
>> The statement also said that because of this, there is about a 15 second
>> difference between GPS time and UTC time, even though the clocks are
>> highly accurate.  Does anyone know if this is true?  If so, a GPS clock
>> might not be the best source for time on a computer network, especially
>> if computers being communicated to are being synced to UTC.
>>      
> The thing is that the difference between GPS time and UTC is well-known,
> and the GPS network is about the most accurate time source we can get
> our hands on next to getting that signal from WWVB.  Since the delta
> between GPS and UTC (and, for that matter, the delta between UTC and
> GMT) is well-known and understood, it can easily be compensated for.
>
> I would consider a system that obtains time from either source (GPS or
> WWVB) to be a stratum 1 server.  However, I wouldn't advertise it on the
> 'net as such, because you'd get a lot of traffic.
>
>    

You're right.  Upon further research, I found that the GPS signal has a 
UTC offset parameter in it, which allows a GPS receiver to calculate and 
display actual UTC time, including the leap seconds.  Of course, that 
doesn't include time zone information and daylight savings time 
information.  That must be calculated on the device itself or the PC if 
applicable based on user input or some other source.

>> I'd also REALLY like to know why the clocks in computers are so widely
>> variable.
>>      
> The RTC present in most computers is simply cheap, that's all.  If you
> need to have a reliable clock attached to the computer, do so.  For 99%+
> of all needs, simply staying in sync with systems on the Internet is
> good enough.
>
>    
>> I know the software clock in the OS is synced to the hardware
>> clock at boot.  But, after that, it apparently varies widely in
>> performance, even though it's receiving periodic interrupts from the
>> hardware clock.
>>      
> Load can be a factor there.  Timer interrupts are not always reliably
> serviced, and they're not always reliably triggered.  They're good
> enough to go on for most work loads, but if you need to have accurate
> time kept over the long haul, you use NTP.  That's just the way that it is.
>
> Sure, the operating system could probably steal a single core from the
> available set of cores, and it could then perhaps run some tests to
> perform better calibration and then use some form of busy-loop to work
> from.  However, while such a thing could perhaps increase the ability of
> the system to track time reliably, it would be wasteful in both terms of
> power spent and the lack of availability of a processor to work with.
> Even on a 6, 8, 12 or 16 core computer, dedicating a single core to the
> purpose of time-keeping is silly when you can just install an NTP client.
>
>    
>> Is it really the case that some routines switch off the
>> hardware interrupts, causing the software clock to miss cycles?  If
>> that's true, why are user level programs allowed to do that.  You'd
>> think processing the hardware interrupt from the hardware clock would be
>> a pretty important thing.
>>      
> It is "pretty important" and it is handled as such.  That doesn't mean
> that it's "stop-the-world important", though.
>
> For systems where there is a need for truly accurate timing, more
> expensive and tightly spec'd components are used (and in the cases where
> a system keeps more accurate time than the kernel can with ticks), the
> kernel can (since source is available!) be trained to use that more
> accurate time source, or even to simply copy its time periodically.
>
> However, it's simply better to use what's already here for that purpose;
> NTP is the way to keep your systems in sync with each other, and that's
> just the way it is.  :-)
>
> 	--- Mike
>
>    

I'm happy to say that I now have NTP running nicely on Linux and 
Windows, with the same server list in ntp.conf, on both systems.  There 
are some variations in the ntp.conf file based on file system and 
directory structure, etc.  I also haven't figured out yet how to have 
the ntpd daemon act as a server to my other computers and set network 
restrictions, etc.  It was not easy to find howto information on doing 
this that was both comprehensive, credible, and clear (in my opinion).  
It took many hours of Googling to find the links I've posted below.  All 
my computers are now staying withing 125ms of true time using internet 
time servers.

However, your comments and those of Mike W. have convinced me to try 
some GPS server experiments.  I've ordered the GlobalSat BU-353 GPS USB 
GPS receiver for $ 26 from Amazon, which has excellent reviews, and am 
looking forward to experimenting with it on both Windows and Linux.  If 
that works properly, I'll set NTP up to poll my own GPS server and then 
use the internet servers as a backup.  I'm hoping that this setup will 
give me accuracy in the 5 - 10 ms range.  Later, I may experiment with 
some GPS's with PPS (Pulse Per Second) outputs which can bring the 
computer's clock to within 1 ms or less of true time, not because I have 
to, but just because I think it's really cool.

PPS actually requires a serial port and the handshaking lines on it to 
provide precise timing.  Ain't that a laugh.  It turns out that the USB 
subsystem inserts too much latency and erratic behavior into the data 
stream.  I also bought a TRENDnet TU-S9 serial - USB converter with full 
hardware flow control.  While this will not be as precise timing wise as 
an actual serial port driving an interrupt, it will give me a place to 
bring in the PPS signal on a handshaking line and get it into the 
system, through the software driver.  It will be interesting to compare 
the final accuracy of a GPS running on USB only to a GPS with PPS 
running through this USB - serial converter.  I looked long and hard for 
a USB - serial converter that supports full hardware flow control like 
this one, and they seem to be very rare.  Finally, while my laptops 
don't have real serial ports any more, the motherboard of my desktop 
does have a header for a serial port on it, I may actually try that out 
some day when I want to go to the trouble.

Here are a number of high quality links I found related to running NTP 
and GPS on both Windows and FreeBSD and Linux.  Also see other links at 
the top and bottom of these pages.  There are also some links to some 
cool GPS and related hardware.  The first few are particularly 
interesting for Linux users.

-----------------------

Linux - Synchronizing linux ntpd to a Garmin GPS 18 LVC via gpsd
      http://www.rjsystems.nl/en/2100-ntpd-garmin-gps-18-lvc-gpsd.php

Linux - Using a Garmin GPS 18 LVC as NTP stratum-0 on Linux 2.6
      http://time.qnan.org/

Linux - Enabling ntpd PPS support for Debian Lenny Linux
      
http://www.worldtimesolutions.com/support/ntp/Debian_Lenny_Linux_PPS_support_for_ntpd.html

Linux - garmin GPS time synchronization tutorial
      http://www.lammertbies.nl/comm/info/GPS-time.html

Windows - Installing NTP on Windows
      http://www.satsignal.eu/ntp/setup.html

Windows and FreeBSD - NTP on a Windows LAN
      http://www.satsignal.eu/ntp/Windows-LAN.html

Windows and FreeBSD - NTP Performance (lots of links at the bottom)
      http://www.satsignal.eu/mrtg/daily_ntp.html

Windows - Using NTP on Windows PCs and a Cable Modem - some notes
      http://www.satsignal.eu/ntp/NTP-cable-modem.html

FreeBSD - An NTP Stratum-1 clock usng a GPS 18 LVC and FreeBSD
      http://www.satsignal.eu/ntp/FreeBSD-GPS-PPS.htm

Windows - An NTP Stratum-1 clock using a GPS 18 LVC and Windows 
2000/XP/Windows-7
      http://www.satsignal.eu/ntp/NTP-on-Windows-serial-port.html

Windows - NTP 4.2.4 compared with NTP 4.2.5
      http://www.satsignal.eu/ntp/V4.2.4.vs.V4.2.5.html

Windows - NTP 4.2.7p241 - The best Windows NTP ever?
      http://www.satsignal.eu/ntp/2011-12-10_notes.html

Windows, would probably work on Linux - Using the Sure Electronics GPS 
evaluation board for NTP
      http://www.satsignal.eu/ntp/Sure-GPS.htm

Laptop GPS World
      http://www.laptopgpsworld.com/

PC clock synchronization using GPS
      http://www.laptopgpsworld.com/3235-pc-clock-synchronization-using-gps

time-nuts Info Page
      http://www.febo.com/cgi-bin/mailman/listinfo/time-nuts

pool.ntp.org: NTP Pool mailing lists
      http://www.pool.ntp.org/en/mailinglists.html

NMEA Protocol Details
      http://catb.org/gpsd/NMEA.txt

********************************

This GPS looks really cool for $ 26 and has excellent Amazon Reviews.  I 
just bought one (don't have it yet).

Amazon.com: GlobalSat BU-353 Waterproof USB GPS Receiver: Electronics
      http://www.amazon.com/gp/product/B000PKX2KA

********************************

  This is a great little GPS.  The 18x is more sensitive than the old 
model 18.  The LVC model, I believe, is the only one with PPS output.

PROVANTAGE: Garmin 010-00321-36 GPS 18x LVC, 5m - Good price on this! - 
~ $ 65
      http://www.provantage.com/garmin-010-00321-36~7GRMO006.htm

Generic GPS with PPS output - Amazon.com: GPS 18x LVC
      
http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=GPS+18x+LVC&x=0&y=0

Amazon.com: Garmin 18x LVC GPS Navigator Unit: GPS & Navigation - good 
technical description on this one
      
http://www.amazon.com/Garmin-18x-LVC-Navigator-Unit/dp/B0016O3T7A/ref=sr_1_1?ie=UTF8&qid=1327185777&sr=8-1

Garmin's website GPS 18x OEM
      https://buy.garmin.com/shop/shop.do?pID=27594&ra=true

*********************************

Generic Board - Mini USB & Bluetooth Interface GPS Demo 
Board_GPS/GPRS/Ethernet - Only $ 35
      http://www.sureelectronics.net/goods.php?id=99

Amazon.com: 9 pin serial header to attach to motherboard of PC and 
provide a serial port output
      
http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=9+pin+serial+header&x=0&y=0

TRENDnet | Products | USB 1.0 / 1.1 / 2.0 Devices | TU-S9 (serial - USB 
converter) (full hardware flow control)
      http://www.trendnet.com/products/proddetail.asp?prod=150_TU-S9&cat=49#


-- 

(PS - If you email me and don't get a quick response, you might want to
call on the phone.  I get about 300 emails per day from alternate energy
mailing lists and such.  I don't always see new messages very quickly.)

Ron Frazier

770-205-9422 (O)   Leave a message.
linuxdude AT c3energy.com



More information about the Ale mailing list