Dec 252017
 
NBSCOM sets your PC's time to the National Bureau of Standards time service in Colorado. Includes C Source.
File NBSCOM.ZIP from The Programmer’s Corner in
Category Science and Education
NBSCOM sets your PC’s time to the National Bureau of Standards time service in Colorado. Includes C Source.
File Name File Size Zip Size Zip Type
NBSCOM.C 17368 5877 deflated
NBSCOM.DOC 10000 4301 deflated
NBSCOM.EXE 44814 28650 deflated
NBSCOM.INI 436 280 deflated

Download File NBSCOM.ZIP Here

Contents of the NBSCOM.DOC file



NBSCOM
Version 1.2
01/07/89
Copyright(c) Franklin Antonio, N6NKF


NBSCOM is a program to allow you to accurately set the DOS date/time in your
PC using the National Bureau of Standards Telephone Time Service.

You simply run NBSCOM, and it dials up the NBS, reads the time, sets your
DOS clock, and tells you how far your DOS clock needed to be advanced or
retarded.

Required equipment: Any PC and a modem.

The NBS Time Service presently uses an ordinary phone number in the 303 area
code. The only cost of using the service is the cost of a very quick long-
distance call. The NBS plans to switch to a 900-number in the future.



Instructions..

Take care of two small configuration setup issues, (telling NBSCOM about
your timezone, and your modem), then you just run the program. See
"Configuration Issues" below.



Running the program..

Just type NBSCOM while at the DOS prompt.

NBSCOM will tell your modem to dial, and all characters exchanged
between the modem and computer will be displayed on the screen. The NBS sends
one time-stamp every second. As soon as NBSCOM has correctly received two time
stamps in a row, it will hangup the phone, and tell you the results. An
example session follows. At any time during the modem dialog, you can type
any key, and the program will hang up the phone and exit immediately.

A sample session...
--- Modem dialog follows --- Type any key to abort. ---
? = HELP
National Bureau of Standards
Telephone Time Service
D L D
MJD YR MO DA H M S ST S UT1 msADV OTM
47511 88-12-16 06:03:44 00 0 -.1 045.0 UTC(NBS) *
47511 88-12-16 06:03:45 00 0 -.1 045.0 UTC(NBS) *

--- Setting DOS Date & Time to local: 12/15/1988 22:03:44 ---
--- Your DOS time was ahead of NBS by 5.22 seconds ---
--- Info only: Your hardware realtime clock reads: 12/15/1988 22:04:44 ---
--- Done --- Phone call duration was 20.4 seconds. ---


The "Info only" line about your hardware realtime clock is only printed if you
have an IBM AT, or a machine with an AT-compatible BIOS. NBSCOM reads the AT
RTC, but does not, at this time, attempt to set it. It makes no attempt to
read or write the large variety of different third-party aftermarket RTCs that
are present in many IBM PC's and XT's.

The average phone call duration is about 20 seconds. If there is phone line
noise that garbles some of the characters, it will take a little longer.
NBSCOM contains a timeout to prevent phone calls longer than 30 seconds.
The NBS has provided a timeout which hangs up the phone at their end at 55
seconds.



Configuration Issues..

You must set a DOS environment variable to tell NBSCOM what timezone you're in.
The program needs this information so that it can convert the UTC (or GMT, or
ZULU or whatever you like to call it) that NBS speaks to your local time.

The environment variable is "TZ". (short for TimeZone) You should put the
command to set it in your autoexec.bat file, so that you never forget.
You must set TZ to your timezone by executing a DOS command like this...

SET TZ=PST8PDT

The first three letters (PST in this case) are the name of a timezone, followed
by an optionally signed number indicating the number of hours difference
between UTC and your timezone, followed by an optional three letter name of a
daylight-savings-time timezone. If you live in an area where daylight-savings-
time is not used, you should leave off the last three letters.

Other examples.. SET TZ=EST5EDT or SET TZ=MST7MDT, etc.

If you don't set TZ at all, it defaults to PST.


This program comes with an initialization file, NBSCOM.INI, which specifies
several parameters which may need to be customized for your computer system.
Parameters in this file include...
1. Which COM port to use. (default COM1)
2. The command to dial your modem (default ATDT1-303-494-4774)
3. The command to hang up your modem (default ATH)
4. The maximum duration allowed for a phone call.
The default parameters should work for more than 90% of all modems, however,
you should modify the file if it doesn't work for your particular setup.

It is also possible to set the baud rate in the .INI file, however, you should
leave it at 1200. The NBS only supports 300 and 1200, and uses different
text formats for each. The program right now only understands the 1200 baud
format.



Copyright statement...

This program (source and object) are Copyright (c) Franklin Antonio, 1988,
All Rights Reserved. They may be freely distributed and used for non-
commercial purposes only. If you redistribute this package, you must
distribute all the files (source, object, doc, ini), in their original,
unmodified, form. You may, additionally, distribute modified versions with
the unmodified versions, but the modified versions must be clearly identified
as modified, with the original copyright statements intact, and the name and
address of the modifier clearly shown.



Why do you need accurate time?

I don't know why *you* need accurate time. I can tell you why I want accurate
time on my PC. I use my computer to point antennas at Earth-orbiting
satellites. Low-Earth-Orbiting satellites move the fastest, and therefore
require the most accurate time. Consider a satellite orbiting at 250 kilometer
altitude. (The Russian MIR space station, and the US Space Shuttle orbit at
about this altitude.) We can calculate how much error we'll have in our
computed antenna pointing angles caused by a certain amount of time error.
These angles change fastest when the satellite is directly overhead, so we'll
compute that case. It comes out like this...

Time ErrorPointing Error
1 second 1.8 degrees
10 seconds 17. degrees
1 minute 61. degrees



Technical Notes:

One of the challenges when writing any program that attempts to dial and
interact with a modem is the very large variety of different brands and
models of modems in use. They all support a slightly different set of
commands, and handle the various RS232 modem control signals in a slightly
different way. Furthermore, there are an amazing variety of different ways
that RS232 cables can be wired.

Most commercial communications programs (Crosstalk, MIRROR, ProComm,...) solve
this problem by providing a large number (as many as 20) different config-
uration files which tell the program how to interact with each different kind
of modem. These differences include the command set, handling of modem control
signals (which are required, and which are provided by the modem), handshake
timing, call progress indications, etc.

I've taken a different approach.

I've written serial i/o routines which are completely oblivious to the state
of the RS232 modem-control signals. If your modem happens to not provide one
of the modem-control signals, or use one of them in an unusual way, NBSCOM
doesn't care. (The standard IBM BIOS, on the other hand, requires that the
modem raise DSR and CTS.) For outgoing modem-control signals, NBSCOM raises
DTR and RTS, which, hopefully will satisfy all modems that care. (The standard
IBM BIOS raises DTR, but then toggles RTS, depending on whether you are reading
or writing to the serial port.)

I've also provided an .INI file where you can specify the exact character
strings that should be sent to your modem to dial and hangup. The Hayes-type
commands that i've included by default will probably work with 90% of all
modems, but if you require something different, you can just change it.

NBSCOM also raises DTR and RTS before dialing, and drops them after dialing.
Some modems hang up the phone in response to a falling DTR instead of a
command.

Finally, while most commercial programs attempt to interact with the call
progress indications (ie detection of dial-tone, busy signal, etc) provided
by most modern modems, i have ignored them completely. I simply dial, then
wait for characters from the modem that look like the NBS format. This has
the disadvantage that if anything goes wrong during the call (say, for example,
a busy signal) a program that listens for the call-progress info from a modem
would know that that had happened immediately, and tell you. This program will
instead simply wait 'til the 30 second timeout occurs. This simpleminded
approach has the advantage that it is compatible with a wide variety of modems,
and it has not yet been an inconvenience. I have yet to get a busy signal from
NBS! You can, of course, immediately abort a call at any time manually, by
typing any key on the keyboard.



Disclaimer..
I have no affiliation with NBS. Comments here do not represent my employer,
or NBS, or anyone but me. This software is given away, not sold. I make no
warranty that this software is suitable for any purpose whatsoever. I have
tested it, and it seems to work for me. My friends Paul Williamson, KB5MU and
Mike Brock, WB6HHV have tested it, and it seemed to work for them. Each of us
has a different brand of computer and modem, so there is a good possibility
that this software will work for you too. Please enjoy it.



Edit History....
Ver 1.0 -- 12/20/88 initial release
Ver 1.1 -- 01/07/88 Bill Taylor & Steve Quigley asked for increased
timeout. "maxtime" now settable in the .ini file
Ver 1.2 -- fix msg when call times out.


Comments about this program can be sent to...

Franklin Antonio, N6NKF
2765 Cordoba Cove
Del Mar, CA 92014
Compuserve ID: 76337,1365 (HAMNET Forum)


Comments about the National Bureau of Standards Telephone Time Service may be
sent to...

NBS-ACTS
Time and Frequency Division
Mail Stop 52
325 Broadway
Boulder, CO 80303




 December 25, 2017  Add comments

Leave a Reply