Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,27 @@
MODULE ModTime EXPORTS Main;
IMPORT IO, Fmt, File, FS, Date, OSError;
TYPE dateArray = ARRAY [0..5] OF TEXT;
VAR
file: File.Status;
date: Date.T;
PROCEDURE DateArray(date: Date.T): dateArray =
BEGIN
RETURN
dateArray{Fmt.Int(date.year), Fmt.Int(ORD(date.month) + 1), Fmt.Int(date.day),
Fmt.Int(date.hour), Fmt.Int(date.minute), Fmt.Int(date.second)};
END DateArray;
BEGIN
TRY
file := FS.Status("test.txt");
date := Date.FromTime(file.modificationTime);
IO.Put(Fmt.FN("%s-%02s-%02s %02s:%02s:%02s", DateArray(date)));
IO.Put("\n");
EXCEPT
| OSError.E => IO.Put("Error: Failed to get file status.\n");
END;
END ModTime.

View file

@ -0,0 +1,22 @@
MODULE SetModTime EXPORTS Main;
IMPORT Date, FS;
<*FATAL ANY*>
VAR
date: Date.T;
BEGIN
(* Set the modification time to January 1st, 1999 *)
date.year := 1999;
date.month := Date.Month.Jan;
date.day := 1;
date.hour := 0;
date.minute := 0;
date.second := 0;
date.offset := 21601;
date.zone := "CST";
FS.SetModificationTime("test.txt", Date.ToTime(date));
END SetModTime.