Guardian Procedure Calls Reference Manual

If a tuid parameter is passed to SYSTEMLOCK_SET_, its value must match TUID, or the call
is rejected with an error.
The principal use of the tuid parameter is to ensure that a relative julian-gmt parameter
was not made obsolete by an intervening time set. However, a tuid parameter can be passed,
and will be checked, with any mode.
System Clock System Message
When the time is reset (but not when it is adjusted), each enabled process receives the SETTIME
system message (-10). A process enables this receipt by passing 1 to PROCESS_MONITOR_NEW_;
see PROCESS_MONITOR_NEW_ Procedure (page 1082) for details.
Clock Subsystem EMS Events
Successful invocation of SYSTEMCLOCK_SET_ generates a CLOCK subsystem event in the system
log. For details, see the HP NonStop Operating System Event Management Programming Manual.
Clock Adjustment Queries
Beginning with the H06.25 and J06.14 RVUs, the PROCESSOR_GETINFOLIST_ procedure reports
information about time adjustments. See the attributes numbered 84 through 89 in
PROCESSOR_GETINFOLIST_ Procedure (page 1156).
Example
The following example is modeled on the NTP protocol, but is not a faithful representation of it. It
illustrates using four timestamps, two each from client and server, to compute the transit time and
(assuming the send and reply latencies are symmetrical) the time offset between server and client.
It also illustrates using TUID to ensure that no other agency has set the time meanwhile.
long long t1, t4, transit, delta;
short tuid, err;
for (;;) {
t1 = JULIANTIMESTAMP(0,&tuid);
/* ... send a datagram containing t1 to a time server;
read the reply, which contains:
t2 (when server received the datagram)
t3 (when server sent the reply). */
t4 = JULIANTIMESTAMP(0);
transit = t4 - t1 - t3 + t2; /* round-trip transit time */
delta = (t2 - t1 + t3 - t4)/2; /* clock offset */
/* ... perform sanity checks on transit time and delta;
apply smoothing heuristics to delta */
err = SYSTEMCLOCK_SET_(delta, ZSYS_VAL_SCS_FORCE_ADJ_REL,
tuid);
if (!err) break;
if (err != ZSYS_VAL_SCS_ERRMISMATCHTUID) {
/* diagnostic code, including break, return or
termination */
/* Somebody else reset the time. Retry.
PROCESS_DELAY_(2000000); /* be polite: wait a couple
seconds */
}
Related Programming Manual
For programming information about the SYSTEMCLOCK_SET_ procedure, see the Guardian
Programmer's Guide.
1412 Guardian Procedure Calls (S)