Скачиваний:
142
Добавлен:
15.03.2015
Размер:
10.83 Mб
Скачать

236 Part III — Data Hacking

Turning Your PC into a High-Precision Atomic Clock

For many people, having accurate time is important, and some people go to great lengths to ensure that the time on their PC is as accurate as possible.

For the ultimate in accurate timing, you need access to an atomic clock. This will give you undisputed accuracy, but it comes with a huge price tag. Another option is to synchronize your PC clock with a time server on the Internet.

Many of these use National Institute of Standards and Technology (NIST) time, but there are many others around the world.

Here is a list of the U.S.-based NIST time servers:

Name

IP Address

Location

 

 

 

time-a.nist.gov

129.6.15.28

NIST, Gaithersburg, Maryland

 

 

 

time-b.nist.gov

129.6.15.29

NIST, Gaithersburg, Maryland

 

 

 

time-a.timefreq.bldrdoc.gov

132.163.4.101

NIST, Boulder, Colorado

 

 

 

time-b.timefreq.bldrdoc.gov

132.163.4.102

NIST, Boulder, Colorado

 

 

 

time-c.timefreq.bldrdoc.gov

132.163.4.103

NIST, Boulder, Colorado

 

 

 

utcnist.colorado.edu

128.138.140.44

University of Colorado, Boulder

 

 

 

time.nist.gov

192.43.244.18

NCAR, Boulder, Colorado

 

 

 

time-nw.nist.gov

131.107.1.10

Microsoft, Redmond, Washington

 

 

 

nist1.symmetricom.com

69.25.96.13

Symmetricom, San Jose, California

 

 

 

nist1-dc.glassey.com

216.200.93.8

Abovenet, Virginia

 

 

 

nist1-ny.glassey.com

216.200.93.9

Abovenet, New York City

 

 

 

nist1-sj.glassey.com

207.126.98.204

Abovenet, San Jose, California

 

 

 

nist1.aol-ca.truetime.com

207.200.81.113

TrueTime, AOL facility, Sunnyvale, California

 

 

 

nist1.aol-va.truetime.com

64.236.96.53

TrueTime, AOL facility, Virginia

 

 

 

These time servers offer you a way to quickly and regularly update your clock to ensure that it is as accurate as possible. Of course, it does require a connection to the Internet, and high traffic on the Internet or your connection can cause problems with the accuracy.

If you are using time servers located on the Internet to adjust your PC clock, make sure that you are using the most accurate stratum 1 time servers.

If you are interested in setting your clock over the Internet, rather than GPS, and you want control over the time server used, you can’t do much better than to use a piece of shareware called Sync-It with Atom, available from www.tolvanen.com/syncit.

Chapter 10 — More Data Tricks 237

One of the best ways that I have found to synchronize a PC with an atomic clock is to use the GPS signal. This offers several advantages over using the Internet:

You don’t need a connection to the Internet. You do, however, need a clear view of the sky.

Each GPS satellite carries with it four atomic clocks. This means that the time signal you will be getting is very accurate indeed.

In addition to the four atomic clocks, you can also take advantage of the capability to average the time from three or more satellites, giving you access to between 12 and 24 four atomic clocks.

All you need to take advantage of this useful access to atomic clocks is a GPS and some software that enables you to make use of it.

The best software I’ve found to carry out this task is called NMEATime by VisualGPS. This software is shareware and it costs $20 to register. NMEATime is available for download from the Visual GPS website at www.visualgps.net/NMEATime/default.htm. If you want to just try it out before committing to buy (always a wise idea), a 30-day trial period is available.

NMEA is an abbreviation for National Marine Electronics Association. It defines the standard that specifies how receivers communicate with each other and other devices (although there are manufacturer specific protocols too). NMEATime can also be used to synchronize a PC’s clock with Internet time servers.

Setting Up the Software

Before you can do anything, you need to set up the software:

1.Download NMEATime from the VisualGPS website.

2.Locate the download and run the executable file.

3.Follow the installation instructions. After NMEATime is installed, you can run the application.

The best thing about NMEATime is its versatility. To get to the configuration screen of the application, right-click on the clock and choose Properties.

You can also gain access to the application by right-clicking the icon in the system tray and choosing Properties.

238 Part III — Data Hacking

Doing this brings up a Properties window filled with settings, as shown in Figure 10-23.

FIGURE 10-23: The NMEATime Properties window

There are several settings on the GPS Configuration tab that will be of interest to you. The first is Comm Settings (see Figure 10-24). Clicking this brings up the Communication Settings dialog box, from which you can select the appropriate Comm port and baud rate, or communication speed (as shown in Figure 10-25). The standard speed for NMEA communication is 4800 bps.

FIGURE 10-24: NMEATime port settings

You can also choose which part of the protocol (or more accurately, which NMEA message contained within the NMEA sentence) is used to get the time information (see Figure 10-26). Of the three NMEA messages to choose from, I recommend that you use the first or second to ensure compatibility:

Chapter 10 — More Data Tricks 239

GPGGA: Provides accurate timing information and is commonly output by GPS receivers

GPRMC: Also provides accurate timing information and is commonly output by GPS receivers

GPZDA: Provides both time and date information but is not usually output by many GPS receivers

FIGURE 10-25: Choosing the appropriate port settings

FIGURE 10-26: NMEA sentence options

There is also the “Hardware 1 pulse per second” setting to consider (see Figure 10-27). When this check box is selected, NMEATime waits for the RS-232 DSR (Data Set Ready) or CTS (Clear To Send) line to change state before setting the PC clock. If the GPS receiver outputs a 1PPS signal, this signal can then be fed back to the DSR or CTS line to maximize synchronization accuracy.

240 Part III — Data Hacking

FIGURE 10-27: Hardware pulse option

Clicking the PPS Settings button also uncovers useful settings (see Figure 10-28). Use the PPS Settings dialog box to select the hardware line to be used as the 1PPS input (DSR or CTS). You can also set the trigger polarity:

Trigger on High to Low Transition: Causes the time to be set on a high to low transition of the 1PPS input

Trigger on Low to High Transition: Causes the time to be set on a low to high transition of the 1PPS input

Trigger on Any Transition: Causes the time to be set on any transition

FIGURE 10-28: PPS Settings dialog box

Sometimes, there may be a slight delay between the time a GPS receiver sends its timing information to the computer and the time the computer receives it. Back in the Properties dialog box, you can factor in this delay using the GPS Time Fix-up Delay value, adjusting the time ahead or behind in milliseconds when setting the system time. The allowable values are from –999ms to 999ms, set as follows:

Chapter 10 — More Data Tricks 241

If the GPS time is early, then a negative value is used.

If the GPS time is late, then a positive value is used.

The GPS Time Fix-up Delay should be set to 0 if the Use Hardware 1PPS option is enabled.

The final set of features on the Time tab is GPS Time Lock. NMEATime enables you to change the criteria that the software considers for a good GPS signal lock. There are two customizable parameters:

The GPS Quality is good (GPGGA) option is directly related to the GPGGA NMEA message. If the GPS Quality indicator from the GPGGA sentence contains any information (that is, it is nonzero), it is considered to be good. If the GPS receiver does not support the GPGGA sentence, then this check box should be unchecked.

Tracking multiple satellites can also be very important. In locations such as urban areas where sky visibility is low because of large buildings blocking the sky, it might be a good idea to have the GPS receiver track multiple satellites before considering the signal, and thus the time, before accepting a signal. For a good, reliable time signal, I recommend that you consider three satellites as the minimum for a good signal lock.

Other settings come into play within the Properties dialog box too. Click the System Configuration tab (see Figure 10-29) and make sure that Set PC Clock Using GPS is checked.

FIGURE 10-29: NMEATime system configuration options

Now click the Update PC Clock tab (see Figure 10-30). Here you can set the update interval for the PC clock. For systems on which you want very accurate time information, you might want to update the clock every 1–10 minutes, whereas for lower accuracy needs you could drop that to twice a day (an interval of 720 minutes). The maximum possible interval is 31 days (44,640 minutes).