AMX Timing Control
K
A
DAK
85
Time/Date Validity
The century is used as follows. At startup, the Time/Date Restart Procedure resets the
century to 0 to indicate that the initial default time and date are incorrect. Note that the
initial time and date are valid; they are just not correct. At some later time, an application
program can issue a call to the Time/Date service procedure ajtds to set a correct time
and date. The century specified as a parameter in that call should be set indicating that
the time and date parameters are correct.
The century can be reset to 0 by an application program with an ajtds call to indicate
that the time and date are incorrect.
When setting the time and date, the day of the week does not have to be provided as long
as the year lies between 1974 and 2099. The Time/Date Manager will figure it out and
set it accordingly.
Time/Date Scheduling
Many real-time systems require that certain activities be performed at specific times of
day. For instance, it may be required that every day at 8:00 a.m. a 24 hour report be
generated. Or maybe every 1/2 hour, measured from the hour, the system must make a
measurement and display the result. The Time/Date Manager provides the mechanism
necessary to implement such features.
At one second intervals the Time/Date Timer Procedure updates the time and date and
then calls an application Scheduling Procedure. The name of this procedure must be
provided in your System Configuration Module (see Chapter 14.4).
Your Scheduling Procedure is called with a FAR procedure call with an actual Time/Date
structure as a parameter. Note that the structure is passed to the procedure by value. The
structure specifies the time and date at the instant the procedure is called.
The Scheduling Procedure is application dependent. It executes as part of the Time/Date
Timer Procedure. It must therefore not be compute or I/O bound.
In general, the procedure checks the time (and date if necessary) and determines if some
application dependent action must be initiated at that instant. If action is required, the
procedure either performs the action directly or requests AMX to start some other task
which is responsible for taking the required action.
You must be sure to allocate sufficient stack to the AMX Kernel Task to accomm odate
the needs of the Scheduling Procedure.