Sysclock Handler (CLOCK_HDL)
Version: 18-Jun-2002 / jn

The program is based on the truetime SG560 clock module with an IRIG B signal input, which is distributed at the Effelsberg site. By calling the function reset_sysclock() the SG560 clock module will be reset and after done that the system time is set corresponding to the time from the module.

The actual year, which is not coded in the IRIG B signal, comes from the vmesystem startup file or by a rpc-call to the date of the host computer. If the year of the file is less than the year from the host, the program takes the year from the host, otherwise the year from the file. That is done to avoid problems with the year early in January.

The CLOCK_HDL task once started awakes regularly (default: every 60 seconds) and reads the SG560 module time and the system time of the computer. If a comparison of these two times gives a difference above or equal two seconds, the system time is reset to the new value from the module.

For the output of error and info messages the task needs the message handler buffer MSG_BUFFER and some functions of the message handler. They must be loaded before the sysclock handler can start.>> For more information see the message handler description.



The following C-functions manage the task:

  • start_sysclock_hdl(int <debug>)

    This function starts the sysclock handler as a background task with a predefined priority. If <debug> is a number not equal 0, the task will print out more messages.

  • stop_sysclock_hdl()

    This function frees the resources of the tasks and kills it.

  • reset_sysclock()

    This function resets the IRIG B truetime module, waits for synchronisation ( can last up to ca. 90 s ), reads the time and date from the module and sets the system clock to that time. There can be an uncertainty of 1 s, because the setting is only exact to one second.

The handler is a C++ class object named Sysclock with the following public member functions:

  • Sysclock(int debug=0);

    debug: !=0 means a printout of debug information

  • ~Sysclock(void);

  • int set(int sec=30,int debug=0);

    Set runtime parameters for sysclock. <sec> is the interval in seconds for testing the system time, if it is not 0 run_check() works only once. <debug> !=0 means a printout of debug information.

  • void check(void);

    Check the time once and set the system time by comparison with the clock-module time if necessary.

  • int check_hard(void);

    Initialize SG560 clock module, read time and set system time.

  • int run_check(void);

    Read clock module and system time regularly defined by <sec>. If <sec> is less than 0, only set once the system time.




jneidhoefer_at_mpifr-bonn.mpg.de