2.12 TIME SYSTEM
2.12.1 Purpose
The Time system of CCS provides the following facilities:
The CCS Time system is provided for Workstations as the CCS tims module and for LCUs the same functions that are contained in tims, were ported to VxWorks. Allowing a standard time accessibility from both platforms. The tims source code for VxWorks is contained under the `time' directory of the lcc3 module (<module-root>/lcu/src/time).
The Time synchronization feature provided by the time system is not part of the tims module. Instead, it is based on the Network Time Protocol and the VLT ntp module. Refer to the next section (2.13) in this document for a detailed explanation about time synchronization inside the VLT project.
The complete functionality of the tims system is fully supported under CCS_LITE.
2.12.2 Basic Concepts
2.12.2.1 Simulation mode
The Time System supports a simulation mode. This mode is independent from the synchronization mechanism, and operates only inside a single CCS environment. Assuming two CCS environments running on the same workstation, one being in simulation mode, the second one would still report the true UTC, or they could both operate independently in simulation mode at two different simulated times.
In that mode, the system clock still shows UTC (synchronized on Time Server or not), but time system subroutines return a different time, calculated by adding or subtracting an offset maintained by the time system. The offset is calculated when the simulation mode is entered, and is kept in the time system internal data.
2.12.2.2 Tims functionality
The tims functionality is basically a library providing a set of routines related to time. The time modes used in tims are: UTC, Local and Simulation. The UTC or Local mode is determined by the current state of time synchronization.
When the Time System is switched to Simulation mode the user must provide the new time to be shown by the time system from now on. An offset with the real UTC is internally calculated and maintained in the time system data area. It is used by any subsequent call to a time system function.
Furthermore tims provides routines to:
2.12.2.3 Timer functionality
The timer functionality of the CCS Time System provides features to synchronize actions to a specific time. Following actions are provided: Scheduling processes, sending CCS message system commands or replies. The actions can be repeated at a specified interval. The timer functionality is build on top of the Rtap Timekeeper, and supports the simulation mode. However, to avoid unpredictable behavior, active requests to the time system must be flushed before switching to/from simulation mode.
2.12.3 Configuration
2.12.3.1 Timer configuration
In order to use the timer functionality of the Time system following entries must be present in the RtapEnvTable(FULL CCS case):
6 1 Y E N A Y 80 128 RtapTimeKeeper
0 2 Y P N N N 50 128 msgServer
or in the CcsEnvTable (CCS_LITE case):
5 3 N N N Y Y 100 128 timsTimeKeeper
0 3 N N N N N 100 128 msgServer
The same entries should also be present on the remote environments that are used e.g. as scheduling targets.
2.12.4 Examples
void main (int argc, char ** argv)
ccsRUNOPT *runopPtr=&runoptions;
stat = ccsInit("timsTest",0,NULL,NULL,&error);
stat = timsGetUTC ( &UTC, &mode, &error);
timsAddTime(&UTC,&interval,&startTime,&error);
if (timerScheduleTask ("wte13",
/* ... error processing ... */
stat = timsTimeToString(&startTime,timsABS_TIME,buffer,&error);
printf("Will start process at: %s\n",buffer);
2.12.5 Reference
Quadralay Corporation http://www.webworks.com Voice: (512) 719-3399 Fax: (512) 719-3606 sales@webworks.com |