| 1 |
(* Library module defined by the International Standard |
| 2 |
Information technology - programming languages |
| 3 |
BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language. |
| 4 |
|
| 5 |
Copyright ISO/IEC (International Organization for Standardization |
| 6 |
and International Electrotechnical Commission) 1996-2021. |
| 7 |
|
| 8 |
It may be freely copied for the purpose of implementation (see page |
| 9 |
707 of the Information technology - Programming languages Part 1: |
| 10 |
Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *) |
| 11 |
|
| 12 |
DEFINITION MODULE SysClock; |
| 13 |
|
| 14 |
(* Facilities for accessing a system clock that records the date |
| 15 |
and time of day *) |
| 16 |
|
| 17 |
CONST |
| 18 |
maxSecondParts = 1000000 ; |
| 19 |
|
| 20 |
TYPE |
| 21 |
Month = [1 .. 12]; |
| 22 |
Day = [1 .. 31]; |
| 23 |
Hour = [0 .. 23]; |
| 24 |
Min = [0 .. 59]; |
| 25 |
Sec = [0 .. 59]; |
| 26 |
Fraction = [0 .. maxSecondParts]; |
| 27 |
UTCDiff = [-780 .. 720]; |
| 28 |
DateTime = |
| 29 |
RECORD |
| 30 |
year: CARDINAL; |
| 31 |
month: Month; |
| 32 |
day: Day; |
| 33 |
hour: Hour; |
| 34 |
minute: Min; |
| 35 |
second: Sec; |
| 36 |
fractions: Fraction; (* parts of a second *) |
| 37 |
zone: UTCDiff; (* Time zone differential |
| 38 |
factor which is the number |
| 39 |
of minutes to add to local |
| 40 |
time to obtain UTC. *) |
| 41 |
summerTimeFlag: BOOLEAN; (* Interpretation of flag |
| 42 |
depends on local usage. *) |
| 43 |
END; |
| 44 |
|
| 45 |
PROCEDURE CanGetClock(): BOOLEAN; |
| 46 |
(* Tests if the clock can be read *) |
| 47 |
|
| 48 |
PROCEDURE CanSetClock(): BOOLEAN; |
| 49 |
(* Tests if the clock can be set *) |
| 50 |
|
| 51 |
PROCEDURE IsValidDateTime(userData: DateTime): BOOLEAN; |
| 52 |
(* Tests if the value of userData is a valid *) |
| 53 |
|
| 54 |
PROCEDURE GetClock(VAR userData: DateTime); |
| 55 |
(* Assigns local date and time of the day to userData *) |
| 56 |
|
| 57 |
PROCEDURE SetClock(userData: DateTime); |
| 58 |
(* Sets the system time clock to the given local date and |
| 59 |
time *) |
| 60 |
|
| 61 |
END SysClock. |