
                              CLK.TXT File

                  (c) Hewlett-Packard Company, 1990.


OVERVIEW
--------

The CLK application keeps the system clock as accurate as possible by
synchronizing the clock with a time standard, and using the accumulated
adjustments with the elapsed time to compute the necessary correction
amount/rate. It is especially useful for applications like navigation that
require extremely accurate times.

Adjustments are made relative to the nearest number of 1/2 hour time-zone 
changes. All changes that are multiples of 1/2 hour are assumed time-zone
changes (and ignored in error correction computation); other changes are 
assumed error corrections. For example, a change of +1:35 is assumed to be 
+1:30 time-zone change (ignored) and +:05 error correction (the clock is 5
minutes slow). A change of +1:25 is assumed to be +1:30 time-zone and -:05
error (the clock is 5 minutes fast). Similar examples apply for -1:35 (-1:30
time-zone and -:05 error) and -1:25 (-1:30 time-zone and +:05 error).


PROCEDURE
---------

 1. Using Kermit, load CLK into your HP 48 HOME directory. (Don't use the HP 48
    built-in TIME SET/ADJST operations while this application is active.) 

 2. Press [VAR]{CLK} to access the application.

 3. Enter a list containing the minimum interrupt rate and the maximum clock
    deviation allowed, press {C.RST}. (This initializes the application.)

 4. If necessary, enter a list containing the current time and date,
    press {C.SET}.

 5. Enter the desired adjustment, press {C.ADJ}.
 
 6. Repeat steps 4 and 5 as needed.

 7. Press {C.XCT} when the clock is synchronized.

 8. Wait a few weeks and then repeat steps 4, 5, 6, and 7.

 9. Press {C.STS} to review the status information.

10. Press {C.SSP} to suspend the correction alarm cycle temporarily; press 
    {C.CNT} to continue the suspended correction alarm.

11. Repeat step 3 to cancel the correction alarm and reinitialize all CLK 
    variables.

-------------------------------------------------------------------------------
NOTE: If you abort the program, flags that were changed by the program will
      remain changed.
-------------------------------------------------------------------------------


USER MENU KEYS
--------------

The following five programs make up the user interface to this package. Each
will give an error message if the expected input is not found. The error
message attempts to indicate the form of the input expected. Time input should
be in the form HH.MMSSs, and date input should be MM.DDYYYY.

{C.SET} - Takes level-1 list containing the current time and date. The clock 
          is set to this time/date. 
                                                                               
{C.ADJ} - Takes from level 1 the amount of adjustment to be applied
          to the current time. A positive amount increases the time and a
          negative amount decreases it. 

{C.XCT} - Takes nothing from the stack; tells the correction package that
          the clock is now exactly synchronized with the time standard. If
          this is the first time it has been invoked, then a time base is
          activated and all error corrections from this point on will be 
          accumulated. If this is the second or subsequent invocation, then
          the time base is extended to this point and the necessary
          calculations are done to set up the clock correction package. An
          alarm is scheduled and the correction package will make the needed
          clock corrections from now on. Subsequent invocations will refine the
          accuracy of the corrections.

{C.RST} - Takes level-1 list containing the minimum interrupt rate and the 
          maximum clock deviation allowed (both in "time" format). The
          correction package is reset to a virgin state--the time base is
          deactivated, the alarm is removed, and further error corrections
          will not be accumulated (the accumulators are cleared). All
          variables are reinitialized and the directory is reordered. 

          Maximum clock deviation specifies the maximum acceptable error for 
          the clock. If the absolute value of the given maximum deviation is 
          less than .01 second, then it is set to 1 second. 

          Minimum interrupt rate specifies the minimum amount of time required
          between clock adjustments. If the absolute value of the given 
          minimum interrupt rate is less than 1 second, then it is set to
          1 minute. If the clock cannot be adjusted to accurate time with the 
          given maximum deviation without using alarms at a more frequent rate
          than allowed by the minimum interrupt rate, the correction amount 
          will be increased as needed to ensure that alarms do not occur
          more often. Consequently, the clock may not be as accurate as  
          specified by the maximum deviation. This ensures that alarms are not
          occurring so often that the HP 48 has no time to do anything else 
          (see the "Note" at the end of the documentation).

{C.STS} - Takes no input from level 1; provides 3 pages of status information
          about the correction package.


          All pages have this header:
                  
          Correction status     -N-    (N = 1, 2, or 3)
                                                                
                           
          All pages have this foot:

          prev:<  exit:V  next:>        (Use the respective HP 48 cursor keys.)


          Display Example (package status), page 1:
            
          Exact initiated(*):
          9.1455  10.301989
          Deviation:   0.000025
          Min rate:    1.0000
            
          The first two lines show the time and date of the first exact
          synchronization. If the display shows "none," an exact has never 
          been done. If there is an (*), then 2 or more exacts have been done 
          and the package is fully activated. If there is no (*), only one 
          exact has been done (errors are being accumulated but no corrections
          are being done yet). The third line shows user specified maximum 
          clock deviation (1/4 second in example). The fourth line shows the 
          user specified minimum interrupt rate (1 hour in example).


          Display Example (adjustment data), page 2:

          Timezones:    0.0000
          Errors:       0.001890
          Timebase:  1718.3909               
 
          The first line shows the total accumulated time-zone changes. The
          second line shows the total accumulated error corrections (18.9 
          seconds in example). The third line shows the total time included in
          the time base (1718 hours, 39 minutes, and 9 seconds in example).


          Display Example (correction data), page 3:

          Next correction:
           11.1644  1.101990
          Repeat:     22.4520
          Adjust:      0.000025

          The first line may be either "Next correction:" (the next correction
          time is displayed) or "Adjust suspended:" (the time that the 
          corrections were suspended is displayed). The third line shows
          the repeat interval of the alarm (22 hours, 45 minutes, and 20 
          seconds in example). The fourth line shows the correction 
          adjustment amount (+1/4 second in example).

          If a status is displayed for 1 minute with no keys pressed, it
          times out and exits.                   


{C.SSP} - Suspends the correction alarm (if corrections are active). The status
          report will indicate the time of the suspension. If the {C.SET},
          {C.ADJ}, or {C.XCT} keys are used while the correction alarm is
          suspended, the results may not be correct. ({C.SSP} is found on page
          2 of the menu.)

{C.CNT} - Resumes (continues) the correction alarm cycle if corrections are 
          active. Any missed corrections will be made and the next correction
          alarm will be set up. ({C.CNT} is found on page 2 of the menu.)



APPLICATION MENU KEYS
---------------------

The {C.TLS} menu key contains subroutines and variables used internally by the 
application. You do not need to use them to run the application.


-------------------------------------------------------------------------------
NOTE: The alarm should work regardless of the directory path when the alarm 
      occurs, and it should leave things as they were when it happened. 
      However, if the HP 48 is off when the alarm occurs, it will be turned on
      and left on until the HP 48 times out. If alarms occur at a rate less 
      than the time-out period, the HP 48 will always be on. If anything is 
      being done when the alarm occurs, the alarm will either not process 
      immediately (when a program is running, the alarm doesn't process until 
      the program terminates), or it will abort what is happening (edits will
      be terminated as if the [ATTN] key had been pressed).
-------------------------------------------------------------------------------

      








