WTIME.EXE (Version 1.0)
Copyright (c) 1992 John Deurbrouck
First Published in PC Magazine October 27, 1992 (Utilities)
WTIME:
WTIME uses your modem to synchronize the clock in your PC with that of the Automatic
Computer Time Service (ACTS), which is maintained by the National Institute of Standards and Technology.
This program can be run under Windows 3.x or OS/2's Windows implementation. With a click of the mouse,
a call taking less than 1 minute will ensure that your date/time stamp is accurate. If you wish, you can
even have WTIME make the call automatically each time you bring up Windows.
To recompile the C source code, you'll need Microsoft Quick C for Windows, Version 1.0; Microsoft C++,
Version, 7.0; Borland C++, Version 3.0; or Borland's Turbo C++ for Windows, Version 1.0.
USING WTIME
In order to install WTIME, you will need to copy two files--WTIME.EXE and WTIME.HLP--into a directory
where Windows can find them. You can run WTIME with Windows' File Run command in the Program Manager,
or you can add WTIME to a Program Manager group by using File New. Note that if you later decide that
you want to run the program every time you load Windows, you simply need to change the WTIME on the command
line to WTIME automatic.
When started, WTIME displays a conventional window with three submenus: File, Modem, and Help. The first
time you use the program you must begin by selecting Modem Setup, which allows you to configure WTIME.
(The Modem Call and Modem Hangup options are initially grayed out.) I'll discuss the configuration process
below, but since it takes longer to describe than to do, let me start with how WTIME works once your modem
is ready to use it.
Setting the time could hardly be simpler: When you select Modem Call, WTIME does the rest. If you have
an external modem, you can monitor the program's progress by watching your modem's lights. In any case,
you'll see the succession of messages that WTIME puts up in its window (``sending escape sequence,'' ``looking
for data,'' and so on). And if you keep Windows' CLOCK visible at the same time, you'll shortly see it
jump to the correct time at the instant WTIME sets it. WTIME will then automatically send an escape sequence
in order to terminate the call.
While a call is in progress, you can cancel it at any time by selecting Modem Hang Up. Selecting File
Exit (the only option under the File menu heading) or double-clicking the system menu will shut down the
program; if a call is in progress, WTIME will not exit until the modem is properly reset.
When using WTIME, you may notice one minor bug in Windows 3.1's CLOCK. If the digital clock display is
active and the time shifts from an hour that has two digits (for example, 10:02) to one with one digit
(such as 9:59), CLOCK does not always erase the leading digit. Thus, in this case, the display may end
up reading 19:59! Just resize the window slightly to force a redraw and the superfluous digit will disappear.
SETTING UP WTIME
The Modem Setup dialog box, lets you configure WTIME for your time zone, daylight saving time preference,
dial string, and COM port.
WTIME's time zone setting, including (when applicable) an X in the Daylight Savings Time box, reflects
the difference between your local time and the Greenwich mean time (GMT), which the ACTS reports. The
menu choices--eastern, central, mountain, and Pacific--cover most readers' locales. Saving your choice
changes the TimeOffset entry in the [WTime] section that WTIME creates in your WIN.INI file. The TimeOffset
entry simply expresses the number of minutes by which your time zone differs from that of the GMT.
If you don't live in one of the preprogrammed time zones, you can still use WTIME by changing the TimeOffset
number in WIN.INI with a text editor. Newfoundland, for example, is 90 minutes in advance of eastern time.
Since the EST TimeOffset is -300, setting TimeOffset to -210 configures WTIME for Newfoundland. Similarly,
Alaska's TimeOffset is -540 (60 minutes behind Pacific time's ÿ2D480), and Hawaii's is -660 (3 hours,
or 180 minutes, behind Pacific time). With manual editing you can also intentionally set your clock a
bit slow or fast. The central time zone's normal TimeOffset, for example, is -360. If you wanted to set
the clock on your PC to run 5 minutes fast, all you would have to do is set TimeOffset to -355.
Valid values for TimeOffset range from -1439 (23 hours 59 minutes before the GMT) to 1439 (23 hours 59
minutes after the GMT). Since several states and locations outside the United States do not observe daylight
saving time, the WTIME utility provides a Use Daylight Savings Time check box.
The Modem Dial String control allows you to change the string your modem uses to dial the ACTS. WTIME
allows a dial string of up to 79 characters.
The default string
ATDT13034944774
should work for most Hayes-compatible modems when you don't need to go through a PBX. The AT signals the
modem that a command is about to follow. The DT specifies Touch-tone dialing, and 13034944774 is the phone
number of the atomic clock you want to reach (303-494-4774). You can insert the hyphens in the actual
dial string if you wish; the modem will ignore them. You can change the dial string. For older, pulse-dialing
systems, you'll need to change the DT to DP, for example. To dial 9 and pause for 2 seconds before actually
dialing the phone number, change the dial string to
ATDT9,,13034944774
You might also want to add an M (for Mute) before the DT, to produce silent operation. Thus your dial
string might look like this:
ATMDT13034944774
One beta-tester even charged WTIME calls to his credit card. This involved several long sequences of digits
separated by series of commas. If you do this, however, don't forget that anyone looking at your WIN.INI
will see your phone credit card number!
The strings shown above will work for most modems. You may need to check your modem's manual for the proper
dialing sequence if the default and modified strings don't work for you.
The last item you need to configure is the COM port. You may choose COM1, COM2, COM3, or COM4 as the port
to which your modem is attached. The modem itself must be capable of operating at 1,200 bits per second
(the fastest speed the ACTS currently supports), and Windows must be configured correctly to handle the
port. If the TERMINAL program that comes with Windows works on your system, WTIME should handle your modem
without a problem.
At any time, you can choose Reset Defaults, Save Configuration, or Cancel. Reset Defaults restores the
original modem dial string, sets the time zone to Eastern, turns on the Daylight Savings Time option,
and sets the COM port to COM1. Save Configuration writes your selected values to WIN.INI, and Cancel closes
the Setup Modem dialog box without affecting your existing setup. You can uninstall WTIME by using NOTEPAD
or SYSEDIT to delete the [WTime] section from WIN.INI. Then you just delete WTIME.EXE and WTIME.HLP. You'll
also want to delete WTIME's icon in the Program Manager if you've set it up there. This process has been
documented in WTIME's on-line help, and it cleanly eliminates WTIME from your system.
- John Deurbrouck is a C and 80x86 assembly programmer who works on PC platforms.
Sources
/ Time Software
|