The Clock

The Clock interface provides access by its parent and friend, the Timer, and via two public methods, clock_time(), and clock_usec, see Figure 8.20.

Figure 8.20: Interface and private methods of the Clock
\begin{tabular}{\vert r\vert l\vert} \hline
...the local time via an operating system call  \hline

The private check_time() method uses the localtime() system call to determine the externally maintained time, in order to see if another second has elapsed since the last call, and, if so, updates the time data member, returning true if an update occurred, and false otherwise.

The Timer must check the Clock sufficiently often to obtain each clock tick, since the check_time() method indicates only the presence or absence of a clock tick, not the number that have occurred.

The TimeStamp constructor is the only client to use the clock_usec method. Clients using the clock_time method include TimeStamp, Timer, Tasks, and various agents such as the Historian.

Bill Pippin 2010-01-14