IDK Trademark IDK COMPUTER SYSTEMS
Hardware/Firmware/Software Integrated Solutions

Patrick J. Gleason, Staff Engineer

Buy this web site... only $499.95!

DAYTIME Client

Author: Patrick J. Gleason
Date: 9-Feb-2007
Project: Bulletron Internet Operating System 12.0
Operating System: OS/2 Warp 4.0 and later, eComStation
Compiler: IBM VisualAge C++ 3.0
Phone: (315) 475-5598
Email: ora68@nehemiah.idkcomp.com

Synopsis:

This program synchronizes the date and time of the local PC with the atomic clock provided by the United States' National Institute of Standards and Technology (NIST). It is intended to supercede and replace a program named "NISTIME.EXE" for eComStation and IBM OS/2, which no longer works because it was hard-coded many years ago with an IP address for the time server that is no longer valid.

The protocol used by this program is named "DAYTIME", which uses well-known TCP/IP port 13. A full explanation and specification for the DAYTIME protocol can be found at "http://tf.nist.gov/service/its.htm", and in RFC 867. The home page for the NIST web site is "http://www.nist.gov".

How it Works:

This program connects to a time standard server using TCP. The server sends back a 51 character message using the same format as ACTS (Automated Computer Time Service) for direct modem dial-in. The format of this message is:

        JJJJJ YR-MO-DA HH:MM:SS TT L H msADV UTC(NIST) OTM

where:

JJJJJ
is the Modified Julian Date (MJD). The MJD has a starting point of midnight on November 17, 1858. You can obtain the MJD by subtracting exactly 2 400 000.5 days from the Julian Date, which is an integer day number obtained by counting days from the starting point of noon on 1 January 4713 B.C. (Julian Day zero).
YR-MO-DA
is the date. It shows the last two digits of the year, the month, and the current day of month.
HH:MM:SS
is the time in hours, minutes, and seconds. The time is always sent as Coordinated Universal Time (UTC). An offset needs to be applied to UTC to obtain local time. For example, Mountain Time in the U. S. is 7 hours behind UTC during Standard Time, and 6 hours behind UTC during Daylight Saving Time.
TT
is a two digit code (00 to 99) that indicates whether the United States is on Standard Time (ST) or Daylight Saving Time (DST). It also indicates when ST or DST is approaching. This code is set to 00 when ST is in effect, or to 50 when DST is in effect. During the month in which the time change actually occurs, this number will decrement every day until the change occurs. For example, during the month of October, the U. S. changes from DST to ST. On October 1, the number will change from 50 to the actual number of days until the time change. It will decrement by 1 every day until the change occurs at 2 a.m. local time when the value is 1. Likewise, the spring change is at 2 a.m. local time when the value reaches 51.
L
is a one-digit code that indicates whether a leap second will be added or subtracted at midnight on the last day of the current month. If the code is 0, no leap second will occur this month. If the code is 1, a positive leap second will be added at the end of the month. This means that the last minute of the month will contain 61 seconds instead of 60. If the code is 2, a second will be deleted on the last day of the month. Leap seconds occur at a rate of about one per year. They are used to correct for irregularity in the earth's rotation. The correction is made just before midnight UTC (not local time).
H
is a health digit that indicates the health of the server. If H=0, the server is healthly. If H=1, then the server is operating properly but its time may be in error by up to 5 seconds. This state should change to fully healthy within 10 minutes. If H=2, then the server is operating properly but its time is known to be wrong by more than 5 seconds. If H=4, then a hardware or software failure has occurred and the amount of the time error is unknown.
msADV
displays the number of milliseconds that NIST advances the time code to partially compensate for network delays. The advance is currently set to 50.0 milliseconds.
UTC(NIST)
is a label contained in every time code. It indicates that you are receiving Coordinated Universal Time (UTC) from the National Institute of Standards and Technology (NIST).
OTM
(on-time marker) is an asterisk (*). The time values sent by the time code refer to the arrival time of the OTM. In other words, if the time code says it is 12:45:45, this means it is 12:45:45 when the OTM arrives. Because of the phase synchronization of bits transmitted over a 1200 Baud analog modem, ACTS can be guaranteed synchronization accuracy within one hundredth of a second by triggering update on the trailing edge of the stop bit for this character. This feature is lost by internet packetization, but synchronization with one second can usually be achieved.

Set Up Details:

A plain ASCII text file, named "DAYTIME.INI" controls the operation of this program. This configuration file defines three parameters, all of which are optional. Blank lines and lines beginning with a semicolon in the configurattion file are ignored as comments. Each parameter line consists of a label, followed by a colon, then a space, then a value. The parameters are:

Label Value
Server: specifies the Internet of the time standard server. If this is not specified, then the default is "time.nist.gov". A current list of servers is published by NIST at "http://tf.nist.gov/service/time-servers.html".
period: specifies the number of hours between synchronizations. If this is not specified, then the program synchronizes the date and time at 24 hour intervals. If you want to just do one synchronization, then exit, perhaps as part of a "CHRON" batch job, then specify 0 for the period.
verbose:

specifies the amount of information recorded in the progam execution log:

0 = log date and time updates and errors only

1 = also include all protocol details

2 = also include DEBUG style (hexadecimal and ASCII) dump of all data sent and received

Running the Program:

You can execute this program from any OS/2 or eCS command line prompt by entering:

        DAYTIME
      

There are no command line parameters.

You can call it from "STARTUP.CMD", put an object for it in your System Startup folder, or whatever.

As the program executes, it displays error messages and progress messages on the screen, and writes them to a file named "DAYTIME.LOG". Various levels of detail in the logging can be enabled to help you debug your setup.

Download DAYTIME.ZIP for eCS