mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-10-10 02:47:23 +00:00
Platform.SetFileMtime and oocFiles.SetModTime.
This commit is contained in:
parent
0decbe950e
commit
575ea5c236
4 changed files with 86 additions and 3 deletions
|
|
@ -566,9 +566,29 @@ BEGIN
|
|||
END Tmp;
|
||||
|
||||
PROCEDURE SetModTime* (file: ARRAY OF CHAR; mtime: Time.TimeStamp; VAR res: Result);
|
||||
VAR
|
||||
name: ARRAY maxPath OF CHAR;
|
||||
day, month: SHORTINT;
|
||||
year: INTEGER;
|
||||
hour, minute, second, seconds: LONGINT;
|
||||
error: Host.Error;
|
||||
BEGIN
|
||||
(* The current host interface exposes modification-time queries only. *)
|
||||
res := GetError(noModTime)
|
||||
IF (mtime.msecs < 0) OR (mtime.msecs >= Time.msecPerDay) THEN
|
||||
res := GetError(invalidTime);
|
||||
RETURN
|
||||
END;
|
||||
JulianDay.DaysToDate(mtime.days, day, month, year);
|
||||
IF year <= 0 THEN
|
||||
res := GetError(invalidTime);
|
||||
RETURN
|
||||
END;
|
||||
seconds := mtime.msecs DIV Time.msecPerSec;
|
||||
hour := seconds DIV 3600;
|
||||
minute := (seconds DIV 60) MOD 60;
|
||||
second := seconds MOD 60;
|
||||
COPY(file, name);
|
||||
error := Host.SetModTime(name, year, month, day, hour, minute, second);
|
||||
IF error = 0 THEN res := done ELSE res := OpenError(error) END
|
||||
END SetModTime;
|
||||
|
||||
PROCEDURE GetModTime* (file: ARRAY OF CHAR; VAR mtime: Time.TimeStamp; VAR res: Result);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,12 @@ BEGIN
|
|||
RETURN error
|
||||
END GetModTime;
|
||||
|
||||
PROCEDURE SetModTime* (VAR name: ARRAY OF CHAR; year, month, day,
|
||||
hour, minute, second: LONGINT): Error;
|
||||
BEGIN
|
||||
RETURN Platform.SetFileMTime(name, year, month, day, hour, minute, second)
|
||||
END SetModTime;
|
||||
|
||||
PROCEDURE CurrentDirectory* (VAR path: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
COPY(Platform.CWD, path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue