home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 18 / wtime.doc < prev    next >
Text File  |  1992-10-05  |  8KB  |  150 lines

  1. WTIME.EXE  (Version 1.0)               Copyright (c) 1992 John Deurbrouck
  2. -------------------------------------------------------------------------
  3.               First Published in PC Magazine October 27, 1992 (Utilities)
  4. -------------------------------------------------------------------------
  5.  
  6. WTIME:
  7.  
  8.       WTIME uses your modem to synchronize the clock in your PC with
  9. that of the Automatic Computer Time Service (ACT), which is maintained
  10. by the National Institute of Standards and Technology.  This program can
  11. be run under Windows 3.x or OS/2's Windows implementation. With a click
  12. of the mouse, a call taking less than 1 minute will ensure that your
  13. date/time stamp is accurate.  If you wish, you can even have WTIME make
  14. the call automatically each time you bring up Windows.
  15.  
  16. To recompile the C source code, you'll need Microsoft Quick C for Windows,
  17. Version 1.0; Microsoft C++, Version, 7.0; Borland C++, Version 3.0; or
  18. Borland's Turbo C++ for Windows, Version 1.0.
  19.  
  20. USING WTIME
  21.  
  22.      In order to install WTIME, you will need to copy two files--WTIME.EXE
  23. and WTIME.HLP--into a directory where Windows can find them.  You can run
  24. WTIME with Windows' File Run command in the Program Manager, or you can add
  25. WTIME to a Program Manager group by using File New.  Note that if you later
  26. decide that you want to run the program every time you load Windows, you
  27. simply need to change the WTIME on the command line to WTIME automatic. 
  28.  
  29.      When started, WTIME displays a conventional window with three
  30. submenus: File, Modem, and Help.  The first time you use the program you
  31. must begin by selecting Modem Setup, which allows you to configure WTIME.
  32. (The Modem Call and Modem Hangup options are initially grayed out.)
  33. I'll discuss the configuration process below, but since it takes longer
  34. to describe than to do, let me start with how WTIME works once your
  35. modem is ready to use it.
  36.  
  37.      Setting the time could hardly be simpler: When you select Modem
  38. Call, WTIME does the rest. If you have an external modem, you can monitor
  39. the program's progress by watching your modem's lights. In any case,
  40. you'll see the succession of messages that WTIME puts up in its window
  41. (``sending escape sequence,'' ``looking for data,'' and so on). And if
  42. you keep Windows' CLOCK visible at the same time, you'll shortly see it
  43. jump to the correct time at the instant WTIME sets it.  WTIME will then
  44. automatically send an escape sequence in order to terminate the call.
  45.  
  46.      While a call is in progress, you can cancel it at any time by
  47. selecting Modem Hang Up. Selecting File Exit (the only option under the
  48. File menu heading) or double-clicking the system menu will shut down
  49. the program; if a call is in progress, WTIME will not exit until the
  50. modem is properly reset.
  51.  
  52.      When using WTIME, you may notice one minor bug in Windows 3.1's CLOCK.
  53. If the digital clock display is active and the time shifts from an hour
  54. that has two digits (for example, 10:02) to one with one digit
  55. (such as 9:59), CLOCK does not always erase the leading digit.  Thus,
  56. in this case, the display may end up reading 19:59!  Just resize the
  57. window slightly to force a redraw and the superfluous digit will
  58. disappear.
  59.  
  60. SETTING UP WTIME
  61.  
  62.      The Modem Setup dialog box, lets you configure WTIME for your time
  63. zone, daylight saving time preference, dial string, and COM port.
  64.  
  65.      WTIME's time zone setting, including (when applicable) an X in the
  66. Daylight Savings Time box, reflects the difference between your local
  67. time and the Greenwich mean time (GMT), which the ACTS reports.
  68. The menu choices--eastern, central, mountain, and Pacific--cover most
  69. readers' locales.  Saving your choice changes the TimeOffset entry in
  70. the [WTime] section that WTIME creates in your WIN.INI file.  The
  71. TimeOffset entry simply expresses the number of minutes by which your
  72. time zone differs from that of the GMT.
  73.  
  74.      If you don't live in one of the preprogrammed time zones, you can
  75. still use WTIME by changing the TimeOffset number in WIN.INI with a text
  76. editor.  Newfoundland, for example, is 90 minutes in advance of eastern
  77. time. Since the EST TimeOffset is -300, setting TimeOffset to -210
  78. configures WTIME for Newfoundland.  Similarly, Alaska's TimeOffset is
  79. -540 (60 minutes behind Pacific time's  2D480), and Hawaii's is -660
  80. (3 hours, or 180 minutes, behind Pacific time).  With manual editing
  81. you can also intentionally set your clock a bit slow or fast.  The
  82. central time zone's normal TimeOffset, for example, is -360.
  83. If you wanted to set the clock on your PC to run 5 minutes fast, all you
  84. would have to do is set TimeOffset to -355.
  85.  
  86.      Valid values for TimeOffset range from -1439 (23 hours 59 minutes
  87. before the GMT) to 1439 (23 hours 59 minutes after the GMT).  Since
  88. several states and locations outside the United States do not observe
  89. daylight saving time, the WTIME utility provides a Use Daylight Savings
  90. Time check box.
  91.  
  92.      The Modem Dial String control allows you to change the string your
  93. modem uses to dial the ACTS.  WTIME allows a dial string of up to 79
  94. characters.
  95.  
  96.       The default string
  97.  
  98.                           ATDT13034944774
  99.  
  100. should work for most Hayes-compatible modems when you don't need to go
  101. through a PBX.  The AT signals the modem that a command is about to follow.
  102. The DT specifies Touch-tone dialing, and 13034944774 is the phone number
  103. of the atomic clock you want to reach (303-494-4774). You can insert the
  104. hyphens in the actual dial string if you wish; the modem will ignore them.
  105.  
  106.      You can change the dial string.  For older, pulse-dialing systems,
  107. you'll need to change the DT to DP, for example.  To dial 9 and pause
  108. for 2 seconds before actually dialing the phone number, change the dial
  109. string to
  110.  
  111.                          ATDT9,,13034944774
  112.  
  113.     You might also want to add an M (for Mute) before the DT, to produce
  114. silent operation.  Thus your dial string might look like this:
  115.  
  116.                          ATMDT13034944774
  117.  
  118. One beta-tester even charged WTIME calls to his credit card.  This
  119. involved several long sequences of digits separated by series of commas.
  120. If you do this, however, don't forget that anyone looking at your
  121. WIN.INI will see your phone credit card number!
  122.  
  123.      The strings shown above will work for most modems.  You may need to
  124. check your modem's manual for the proper dialing sequence if the default
  125. and modified strings don't work for you.
  126.  
  127.      The last item you need to configure is the COM port.  You may choose
  128. COM1, COM2, COM3, or COM4 as the port to which your modem is attached.
  129. The modem itself must be capable of operating at 1,200 bits per second
  130. (the fastest speed the ACTS currently supports), and Windows must be
  131. configured correctly to handle the port.  If the TERMINAL program that
  132. comes with Windows works on your system, WTIME should handle your modem
  133. without a problem.
  134.  
  135.      At any time, you can choose Reset Defaults, Save Configuration, or
  136. Cancel.  Reset Defaults restores the original modem dial string, sets the
  137. time zone to Eastern, turns on the Daylight Savings Time option, and sets
  138. the COM port to COM1.  Save Configuration writes your selected values to
  139. WIN.INI, and Cancel closes the Setup Modem dialog box without affecting
  140. your existing setup.
  141.  
  142.      You can uninstall WTIME by using NOTEPAD or SYSEDIT to delete the
  143. [WTime] section from WIN.INI.  Then you just delete WTIME.EXE and
  144. WTIME.HLP.  You'll also want to delete WTIME's icon in the Program
  145. Manager if you've set it up there.  This process has been documented in
  146. WTIME's on-line help, and it cleanly eliminates WTIME from your system.
  147. ------------------------------------------------------------------------
  148. John Deurbrouck is a C and 80x86 assembly programmer who works on
  149. PC platforms.
  150.