Such activities might not stress the computing power of today's personal computers, but they sure can tax their internal clocks. For some applications, having the correct time is essential. For example, the operating software for the CCD cameras made by the Santa Barbara Instrument Group "stamps" images with the date and time from the computer's system clock when storing them. If your clock is wrong, confusion over when an image was taken could ruin a night's work.
Unfortunately, the IBM PC was not designed with process control in mind, and its clock suffers from low accuracy and a few other deficiencies. Timekeeping in Macintosh computers isn't any better. Understanding how the clock in a computer works may help you improve its performance.
A PC'S HISTORY OF TIME
Off-the-shelf IBM PC and compatible computers keep time in three ways. The original PC used a clock generated purely by software - the disk operating system (DOS) - and regulated by the crystal that controlled the computer's central processing unit (CPU). This clock always started from 00:00:00.0 and January 1, 1980, when the power was turned on and had to be set (using DOS commands) to be of any use. This DOS or "system" clock had a resolution of 1,573,040 ticks per day or about 18.2 ticks per second close, but not exactly 65,536 ([2.sup.16]) per hour. Furthermore, the time was only as accurate as a PC's crystal - a typical accuracy of 0.1 percent yields a clock that can be off by 86 seconds per day.
Soon vendors offered add-on clock boards with batteries to keep time when the power was off. An add-on clock is completely separate from the PC circuitry, frequently mounted on a memory or other expansion card. Typically it has resolution of 0.001 second and keeps the correct time to within 5 or 10 seconds per day. Some can even be adjusted to improve their accuracy. A utility program must initialize and set it, as well as copy its time and date to the system clock.
Today's PC models utilize the system clock and a battery clock integrated into the computer's motherboard - the so-called Real Time Clock (RTC). First used on the PC AT with the 80286 chip, the RTC has an accuracy of about [+ or -]10 seconds per day and one-second resolution. The time and date are copied automatically to set the system clock during start-up. Both the RTC and the system clock can be set at any time by means of the DOS commands TIME and DATE. Although the system clock can be set with the resolution of 1/18 second, the RTC rounds down to the whole second.
Obviously, standard-issue PCs do not provide what is needed for process control or real-time tasks; in fact they are not even good enough just to tell the time of day. The system clock's accuracy depends on the crystal's manufacturing tolerance and frequency stability with temperature changes. Moreover, some nagging design deficiencies have survived multiple updates of the operating system. One of these is the so-called "midnight bug," which causes the system clock to lose days if the computer is left idle with a program loaded and several midnights pass. Other annoyances include the inability to set the clock forward or back by a given amount of time, the lack of coupling between the RTC and the system (which causes the two clocks to diverge due to their different speeds), and the inability to adjust the tick count per unit time for rate compensation.
On the other hand, enough flexibility was designed into the PC and its operating system to keep many users intrigued and thus foster the development of many interesting hardware and software products. Timekeeping can be improved significantly but only if these options are selected carefully. Some that offer the highest accuracy may only realize their potential when teamed with specific PC hardware and software combinations.
GETTING THE RIGHT TIME
The most basic way to improve accuracy is to set the time frequently from a time signal received by radio, telephone, or a more accurate clock or watch. The achievable accuracy is usually between 0.1 and 0.5 second, depending on your skill and patience. Unfortunately, this simple approach can be very tedious and sometimes impractical.
Time signals can be heard on the telephone by calling the U.S. Naval Observatory at 202-653-1800 (Washington, D.C.) or WWV at 303-499-7111 (Boulder, Colorado). For critical applications, those in the U.S. can access the USNO's master-clock at 900-410-8463. These calls are automatically routed through landlines to ensure 1/40-second accuracy in the contiguous states. The charge is 50 cents for the first minute and 45 cents for each minute thereafter. Many local phone companies also provide time services that are reasonably accurate. The WWV and WWVH (Hawaii) time signals are also broadcast by shortwave radio (see page 48 of last month's issue).
Modem owners can take advantage of time provided by some online services, or they can use a program that dials up the Automated Computer Time Service (ACTS) of the National Institute of Standards and Technology (NIST), which also maintains WWV. Examples of these utilities for PCs and Macs are listed in the accompanying box. Remember that the high accuracy of this approach, as claimed by the software authors, is quickly lost on a system clock that loses one second per hour. The user registration fees for these shareware programs are modest, ranging from $15 to $30.
The periodic need to reset the clock would be greatly reduced if the RTC were simply a better clock with some means of compensation. So why not add a new clock? Some expansion boards boast clocks better than [+ or -]5 seconds per month. The included software runs in the background as a terminate-and-stay-resident (TSR) program that resets the system clock periodically to bring it back in line thus preventing significant drift. The user can select how often to correct the system. One card is the Network Reference Card available from Industrial Computer Source ($199.00).
A top-of-the-line solution is to add a special radio receiver that listens to the Morse-code portion of the WWV signal and continually updates the time of the PC. This option keeps the system clock in sync with the NIST atomic clock, correctly handles leap seconds and daylight-time changes in the U.S., and achieves an accuracy measured in milliseconds. Such devices include the TL-3 TrueTime receiver available from Personal Computing Tools ($510.00) and the Universal Time Standard receiver from Odetics' Precision Time Division ($595.00).
Thankfully, it is not necessary to add expensive hardware and spend a fortune to reduce system-clock drift by a couple orders of magnitude. An elegant and simple way is to use software. Any stable clock, after its rate is measured against a standard, can be used to derive the exact time. For example, in ship-carried navigation chronometers of the 1800s a stable rate was more desirable than a correct rate (S&T: June 1988, page 658). If the rate of a computer's clock is known, and its stability is reasonable, the software can reduce the error to only one second per week, or even one second per month. Luckily most PCs operate in a benign environment, and consequently their clocks remain reasonably stable.
Several software utilities correct the system time this way. Some are designed as TSR programs; others avoid the potential problems associated with TSRs (conflicts with other software) and are designed to work as ordinary DOS programs that can be called up from the command line during start-up or at any other time, specifically before running a program that needs correct time. Several programs for PCs and Macs, including my own, are listed in the box on page 82.
The timepiece in your PC is, by many standards, quite awful. But by using some of the techniques described here, you can still have an accurate clock for casual and scientific use. Soon you can be setting your watch from your computer, instead of the other way around.
PAVEL OTAVSKY 26 Barberry Hill Woodstock, VT 05091
RELATED ARTICLE: Computer Timekeeping Solutions
Hardware solutions. The products noted in the main article for IBM PC and compatible computers are available from:
* Industrial Computer Source, P.O. Box 910557, San Diego, CA 92191; 800-523-2320 or 619-677-0877. Real Time Clock cards, Global Positioning Satellite (GPS) time and location cards.
* Odetics, Precision Time Division, 1515 S. Manchester Ave., Anaheim, CA 92802; 714-758-0400. Precision add-on clocks, time and GPS cards.
* Personal Computing Tools, 90 Industrial Park Rd., Hingham, MA 02043; 800-767-6728 or 617-740-0120. WWV receivers that connect to PCs.
Software solutions. Most of these products are "shareware" (try-before-you-buy) items available from commercial on-line services, the Internet (see page 83), computer bulletin-board systems (BBSs), computer user groups, and mail-order companies (which advertise in computer magazines). Here are a few for IBM PCs and compatibles:
* Clock (shareware) by Ronald Q. Smith features two DOS utilities: one to replace a PC's internal clock driver and one to adjust the clock automatically based on the calculated drift. (Pacific Standard Time, P.O. Box 2697, Santa Clara, CA 95055; 408-246-0589.)
* Clock Work (shareware) by Pavel Otavsky enhances the clock-setting capability of DOS and automatically adjusts the system clock to maintain accuracy of up to one second per week. (Barberry Hill Software and Engineering, 26 Barberry Hill, Woodstock, VT 05091; 802-457-2654; e-mail: PavelOt@]aol.com.)
* ClockWrightT, Otavsky's commercial utility, can be used with DOS, Windows, or OS/2. Additional features include a time and date calculator and modem accessory to call an accurate time server. $39.00.
* PCClock (shareware) by Michael J. Sadaway calls a time server via modem to set the system clock. It also acts as a background alarm clock. (P.O. Box 128-P, South Walpole, MA 02071.)
* RightTime (shareware) by G.T. Becker is a DOS TSR program providing 0.01-second resolution in the system clock, (14232 Marsh Lane, Suite 339, Dallas, TX 75234.)
* TimeSet (shareware) by Peter Petrakis calls any of five time servers in the U.S., Sweden, Austria, and Italy via modem to set the system clock. (Life Sciences Software, 8925 271st St. NW, Suite 112, Stanwood, WA 98292.)
The software items below for Macintosh computers are all freeware:
* AutoClock by Jean-Pierre Gachen calls a time server via modem and can automatically adjust the system clock once its mean deviation is determined.
* ClockAdjust by Jim Nitchals adjusts the system clock once a week to offset drift.
* NIST Time Clock by Jeffrey Andre calls the NIST time server in Boulder, Colorado, and sets the system clock.
* SetClock by Jim Leitch calls one of three time servers and sets the system clock to within one second.
Otavsky, who writes and markets his utility software as a sideline, is the manager of mechanical engineering at Miltope Corp.
|Printer friendly Cite/link Email Feedback|
|Publication:||Sky & Telescope|
|Article Type:||Book Review|
|Date:||Feb 1, 1996|
|Previous Article:||The Immortal Fire Within: The Life and Work of Edward Emerson Barnard.|
|Next Article:||Spotted with stars.|