System.Date (v8.0)
Posted: Mon Oct 25, 2021 9:19 am
The new System.Date procedure in v8.0:
can leave 'dt' undefined if one of the integer arguments has an out-of-range value. 'Texts.WriteClock(W, dt)' will then print a value that is most likely not correct.
I have fixed this thusly OMM:
This has the additional advantage that we can verify that setting the clock via 'Kernel.SetClock' has worked.
Code: Select all
PROCEDURE Date*;
(* ... *)
BEGIN
(* ... *)
IF S.class = Texts.Int THEN (*set clock*)
(* ... *)
IF (day >= 1) & (day <= 31) & (mo >= 1) & (mo <= 12) & (yr >= 0) & (yr <= 63) THEN
dt := ((((yr*16 + mo)*32 + day)*32 + hr)*64 + min)*64 + sec;
Kernel.SetClock(dt)
END
ELSE (*read clock*)
dt := Oberon.Clock()
END;
Texts.WriteClock(W, dt); EndLine
END Date;
I have fixed this thusly OMM:
Code: Select all
PROCEDURE Date*;
(* ... *)
BEGIN
(* ... *)
IF S.class = Texts.Int THEN (*set clock*)
(* ... *)
IF (day >= 1) & (day <= 31) & (mo >= 1) & (mo <= 12) & (yr >= 0) & (yr <= 63) THEN
dt := ((((yr*16 + mo)*32 + day)*32 + hr)*64 + min)*64 + sec;
Kernel.SetClock(dt)
END
END;
dt := Oberon.Clock();
Texts.WriteClock(W, dt); EndLine
END Date;