DEFINITION MODULE SysClock; (* ISO 10514-1 clock interface plus PIM-style Time/Clock helpers. GetClock returns UTC (zone = 0, no summer time); SetClock is not supported (CanSetClock = FALSE). *) CONST maxSecondParts = 1000000; CONST ClocksPerSec = 1000000; (* Processor-time ticks per second (libc CLOCKS_PER_SEC). *) TYPE Month = [1 .. 12]; Day = [1 .. 31]; Hour = [0 .. 23]; Min = [0 .. 59]; Sec = [0 .. 59]; Fraction = [0 .. maxSecondParts]; UTCDiff = [-780 .. 720]; DateTime = RECORD year: CARDINAL; month: Month; day: Day; hour: Hour; minute: Min; second: Sec; fractions: Fraction; (* parts of a second *) zone: UTCDiff; (* minutes to add to local time for UTC *) summerTimeFlag: BOOLEAN; END; PROCEDURE CanGetClock (): BOOLEAN; (* TRUE: the system clock can be read. *) PROCEDURE CanSetClock (): BOOLEAN; (* FALSE: V3 does not set the system clock. *) PROCEDURE IsValidDateTime (userData: DateTime): BOOLEAN; (* Range-check a date/time value. *) PROCEDURE GetClock (VAR userData: DateTime); (* The current UTC date and time. *) PROCEDURE SetClock (userData: DateTime); (* Unsupported: CanSetClock is FALSE, so this is a no-op. *) PROCEDURE Time () : LONGINT; (* Seconds since the Unix epoch (1 January 1970, 00:00 UTC). *) PROCEDURE Clock () : LONGINT; (* Processor time used so far, in ticks of ClocksPerSec per second. *) END SysClock.