* subroutines working with an OS dependend time stamp use an int64 now, so the 2038 problem

on unixes can be tackled

git-svn-id: trunk@44010 -
This commit is contained in:
florian 2020-01-21 20:59:20 +00:00
parent a640a8d21e
commit 01302bc47d
32 changed files with 100 additions and 69 deletions

2
.gitattributes vendored
View File

@ -15530,6 +15530,7 @@ tests/test/units/cpu/tcpu1.pp svneol=native#text/pascal
tests/test/units/crt/tcrt.pp svneol=native#text/plain
tests/test/units/crt/tctrlc.pp svneol=native#text/plain
tests/test/units/dateutil/testscandatetime.pas svneol=native#text/plain
tests/test/units/dateutil/tunitdt1.pp svneol=native#text/pascal
tests/test/units/dos/hello.pp svneol=native#text/plain
tests/test/units/dos/tbreak.pp svneol=native#text/plain
tests/test/units/dos/tdisk.pp svneol=native#text/plain
@ -15737,6 +15738,7 @@ tests/test/units/sysutils/tuplow.pp svneol=native#text/plain
tests/test/units/sysutils/twstralloc.pp svneol=native#text/plain
tests/test/units/sysutils/twstrcmp.pp svneol=native#text/plain
tests/test/units/ucomplex/tcsqr1.pp svneol=native#text/pascal
tests/test/units/unixutil/tepoch1.pp svneol=native#text/pascal
tests/test/units/variants/tcustomvariant.pp svneol=native#text/plain
tests/test/units/variants/tvararrayofintf.pp svneol=native#text/plain
tests/test/units/variants/tw26370.pp svneol=native#text/plain

View File

@ -205,7 +205,7 @@ begin
end;
function FileSetDate(Handle: THandle; Age: LongInt) : LongInt;
function FileSetDate(Handle: THandle; Age: Int64) : LongInt;
var
tmpDateStamp: TDateStamp;
tmpName: array[0..255] of char;
@ -223,7 +223,7 @@ begin
end;
function FileSetDate(const FileName: RawByteString; Age: LongInt) : LongInt;
function FileSetDate(const FileName: RawByteString; Age: Int64) : LongInt;
var
tmpDateStamp: TDateStamp;
SystemFileName: RawByteString;
@ -368,7 +368,7 @@ end;
(****** end of non portable routines ******)
function FileAge (const FileName : RawByteString): Longint;
function FileAge (const FileName : RawByteString): Int64;
var
tmpLock: BPTR;
tmpFIB : PFileInfoBlock;

View File

@ -87,7 +87,7 @@ begin
end;
function FileSetDate(Handle: THandle; Age: LongInt) : LongInt;
function FileSetDate(Handle: THandle; Age: Int64) : LongInt;
var
td: TDOSTIME;
begin
@ -99,7 +99,7 @@ begin
end;
function FileSetDate(const FileName: RawByteString; Age: LongInt) : LongInt;
function FileSetDate(const FileName: RawByteString; Age: Int64) : LongInt;
var
f: THandle;
begin
@ -203,7 +203,7 @@ end;
(****** end of non portable routines ******)
function FileAge (const FileName : RawByteString): Longint;
function FileAge (const FileName : RawByteString): Int64;
var
f: THandle;
begin

View File

@ -129,7 +129,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
begin
result := -1;
end;

View File

@ -647,7 +647,7 @@ asm
end {['eax', 'ebx', 'ecx', 'edx']};
function FileAge (const FileName: RawByteString): longint;
function FileAge (const FileName: RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen (FileName, 0);

View File

@ -67,7 +67,7 @@ begin
end;
function FileSetDate(Handle, Age: LongInt) : LongInt;
function FileSetDate(Handle, Age: Int64) : LongInt;
begin
result := -1;
end;
@ -140,7 +140,7 @@ end;
(****** end of non portable routines ******)
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
begin
result := -1;
end;

View File

@ -284,7 +284,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen(FileName, 0);
@ -442,7 +442,7 @@ begin
end;
Function FileSetDate (Handle, Age : Longint) : Longint;
Function FileSetDate (Handle, Age : Int64) : Longint;
var
Regs: registers;
begin

View File

@ -190,7 +190,7 @@ begin
*)
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
(*
Var Info : Stat;
@ -462,7 +462,7 @@ begin
end;
Function FileSetDate (Handle,Age : Longint) : Longint;
Function FileSetDate (Handle,Age : Int64) : Longint;
begin
// TODO fix

View File

@ -289,7 +289,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen(FileName, 0);
@ -441,7 +441,7 @@ begin
end;
Function FileSetDate (Handle : THandle; Age : Longint) : Longint;
Function FileSetDate (Handle : THandle; Age : Int64) : Longint;
var
Regs: registers;
begin

View File

@ -313,7 +313,7 @@ begin
aNtTime.QuadPart := local.QuadPart + bias.QuadPart;
end;
function FileAge(const FileName: UnicodeString): Longint;
function FileAge(const FileName: UnicodeString): Int64;
begin
{ TODO }
Result := -1;
@ -868,7 +868,7 @@ begin
end;
function FileSetDate(Handle: THandle;Age: Longint): Longint;
function FileSetDate(Handle: THandle;Age: Int64): Longint;
var
res: NTSTATUS;
basic: FILE_BASIC_INFORMATION;

View File

@ -76,7 +76,7 @@ begin
end;
function FileSetDate(Handle, Age: LongInt) : LongInt;
function FileSetDate(Handle, Age: Int64) : LongInt;
begin
result := -1;
end;
@ -166,7 +166,7 @@ end;
(****** end of non portable routines ******)
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var
info: Stat;
SystemFileName: RawByteString;

View File

@ -176,7 +176,7 @@ begin
FileTruncate:=(_chsize(Handle,Size) = 0);
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen(FileName, 0);
@ -211,7 +211,7 @@ begin
FileUnlock := FileUnlock (Handle, longint(FOffset),longint(FLen));
end;
Function FileAge (Const FileName : String): Longint;
Function FileAge (Const FileName : String): Int64;
VAR Info : NWStatBufT;
PTM : PNWTM;
@ -380,7 +380,7 @@ begin
end;
Function FileSetDate (Handle : THandle; Age : Longint) : Longint;
Function FileSetDate (Handle : THandle; Age : Int64) : Longint;
begin
{ i think its impossible under netware from FileHandle. I dident found a way to get the
complete pathname of a filehandle, that would be needed for ChangeDirectoryEntry }

View File

@ -336,7 +336,7 @@ BEGIN
END;
{
Function FileSetDate (Handle,Age : Longint) : Longint;
Function FileSetDate (Handle,Age : Int64) : Longint;
Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
}
PROCEDURE SysUtilsTest;

View File

@ -201,7 +201,7 @@ begin
FileUnlock := -1;
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Info : TStat;
TM : TTM;
SystemFileName: RawByteString;

View File

@ -1238,7 +1238,7 @@ begin
end ;
Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
Function DateTimeToFileDate(DateTime : TDateTime) : Int64;
Var YY,MM,DD,H,m,s,msec : Word;
@ -1266,7 +1266,7 @@ begin
Result := SysTime.Year;
end;
Function FileDateToDateTime (Filedate : Longint) : TDateTime;
Function FileDateToDateTime (Filedate : Int64) : TDateTime;
{$ifndef unix}
Var Date,Time : Word;

View File

@ -158,8 +158,8 @@ function FormatDateTime(const FormatStr: string; DateTime: TDateTime; Options :
function FormatDateTime(const FormatStr: string; DateTime: TDateTime; const FormatSettings: TFormatSettings; Options : TFormatDateTimeOptions = []): string;
procedure DateTimeToString(out Result: string; const FormatStr: string; const DateTime: TDateTime; Options : TFormatDateTimeOptions = []);
procedure DateTimeToString(out Result: string; const FormatStr: string; const DateTime: TDateTime; const FormatSettings: TFormatSettings; Options : TFormatDateTimeOptions = []);
Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
Function FileDateToDateTime (Filedate : Longint) :TDateTime;
Function DateTimeToFileDate(DateTime : TDateTime) : int64;
Function FileDateToDateTime (Filedate : Int64) :TDateTime;
function TryStrToDate(const S: ShortString; out Value: TDateTime): Boolean; {$ifdef SYSUTILSINLINE}inline;{$endif}
function TryStrToDate(const S: AnsiString; out Value: TDateTime): Boolean; {$ifdef SYSUTILSINLINE}inline;{$endif}
function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean;

View File

@ -40,7 +40,7 @@ begin
end;
Function FileAge (Const FileName : UnicodeString): Longint;
Function FileAge (Const FileName : UnicodeString): Int64;
begin
Result:=FileAge(ToSingleByteFileSystemEncodedFileName(FileName));
end;
@ -92,7 +92,7 @@ end;
{$ifdef OS_FILESETDATEBYNAME}
Function FileSetDate (Const FileName : UnicodeString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : UnicodeString;Age : Int64) : Longint;
begin
Result:=FileSetDate(ToSingleByteFileSystemEncodedFileName(FileName),Age);
end;
@ -257,7 +257,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
begin
Result:=FileAge(UnicodeString(FileName));
end;
@ -306,7 +306,7 @@ end;
{$endif}
{$ifdef OS_FILESETDATEBYNAME}
Function FileSetDate (Const FileName : RawByteString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : RawByteString;Age : Int64) : Longint;
begin
Result:=FileSetDate(UnicodeString(FileName),Age);
end;

View File

@ -46,7 +46,7 @@ Type
// The actual unicode search record
TUnicodeSearchRec = Record
Time : Longint;
Time : Int64;
Size : Int64;
Attr : Longint;
Name : UnicodeString;
@ -65,7 +65,7 @@ Type
end;
TRawbyteSearchRec = Record
Time : Longint;
Time : Int64;
Size : Int64;
Attr : Longint;
Name : RawByteString;
@ -173,11 +173,11 @@ Function FileCreate (Const FileName : UnicodeString) : THandle;
Function FileCreate (Const FileName : UnicodeString; Rights : Integer) : THandle;
Function FileCreate (Const FileName : UnicodeString; ShareMode : Integer; Rights : Integer) : THandle;
{$IFNDEF FPUNONE}
Function FileAge (Const FileName : UnicodeString): Longint;
Function FileAge (Const FileName : UnicodeString): Int64;
{$ENDIF}
Function FileExists (Const FileName : UnicodeString; FollowLink : Boolean = True) : Boolean;
Function DirectoryExists (Const Directory : UnicodeString; FollowLink : Boolean = True) : Boolean;
Function FileSetDate (Const FileName : UnicodeString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : UnicodeString;Age : Int64) : Longint;
Function FileGetAttr (Const FileName : UnicodeString) : Longint;
Function FileSetAttr (Const Filename : UnicodeString; Attr: longint) : Longint;
Function DeleteFile (Const FileName : UnicodeString) : Boolean;
@ -199,7 +199,7 @@ Function FileCreate (Const FileName : RawByteString; Rights : Integer) : THandle
Function FileCreate (Const FileName : RawByteString; ShareMode : Integer; Rights : Integer) : THandle;
Function FileExists (Const FileName : RawByteString; FollowLink : Boolean = True) : Boolean;
Function DirectoryExists (Const Directory : RawByteString; FollowLink: Boolean = True) : Boolean;
Function FileSetDate (Const FileName : RawByteString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : RawByteString;Age : Int64) : Longint;
Function FileGetAttr (Const FileName : RawByteString) : Longint;
Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
Function DeleteFile (Const FileName : RawByteString) : Boolean;
@ -211,7 +211,7 @@ Function ExeSearch (Const Name : RawByteString; Const DirList : RawByteString =
Function FileIsReadOnly(const FileName: RawByteString): Boolean;
function FileAge(const FileName: RawByteString; out FileDateTime: TDateTime; FollowLink: Boolean = True): Boolean;
{$ifndef FPUNONE}
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
{$endif}
function FileGetSymLinkTarget(const FileName: RawByteString; out SymLinkRec: TRawbyteSymLinkRec): Boolean;
function FileGetSymLinkTarget(const FileName: RawByteString; out TargetName: RawByteString): Boolean; inline;
@ -225,7 +225,7 @@ Procedure FileClose (Handle : THandle);
Function FileTruncate (Handle : THandle;Size: Int64) : boolean;
Function FindNext (Var Rslt : TRawByteSearchRec) : Longint;
Procedure FindClose (Var F : TRawByteSearchrec);
Function FileGetDate (Handle : THandle) : Longint;
Function FileSetDate (Handle : THandle;Age : Longint) : Longint;
Function FileGetDate (Handle : THandle) : Int64;
Function FileSetDate (Handle : THandle;Age : Int64) : Longint;
Function GetFileHandle(var f : File):THandle;
Function GetFileHandle(var f : Text):THandle;

View File

@ -58,7 +58,7 @@
{$ifndef OS_FILESETDATEBYNAME}
Function FileSetDate (Const FileName : RawByteString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : RawByteString;Age : Int64) : Longint;
Var
fd : THandle;
begin
@ -79,7 +79,7 @@
end;
Function FileSetDate (Const FileName : UnicodeString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : UnicodeString;Age : Int64) : Longint;
Var
fd : THandle;
begin
@ -823,4 +823,4 @@ begin
else
Result:=ifFalse;
end;
{$ENDIF}
{$ENDIF}

View File

@ -214,7 +214,7 @@ begin
OSErrorWatch (RC);
end;
function FileAge (const FileName: RawByteString): longint;
function FileAge (const FileName: RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen (FileName, 0);

View File

@ -59,7 +59,7 @@ begin
end;
function FileSetDate(Handle, Age: LongInt) : LongInt;
function FileSetDate(Handle, Age: Int64) : LongInt;
begin
result := -1;
end;
@ -129,7 +129,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
begin
result := -1;
end;

View File

@ -596,7 +596,7 @@ begin
end;
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
Var
Info : Stat;
SystemFileName: RawByteString;
@ -1041,7 +1041,7 @@ Begin
End;
Function FileGetDate (Handle : Longint) : Longint;
Function FileGetDate (Handle : Longint) : Int64;
Var Info : Stat;
@ -1053,7 +1053,7 @@ begin
end;
Function FileSetDate (Handle,Age : Longint) : Longint;
Function FileSetDate (Handle : Longint;Age : Int64) : Longint;
begin
// Impossible under Linux from FileHandle !!
@ -1111,7 +1111,7 @@ begin
Result:=fpAccess(PChar(SystemFileName),W_OK)<>0;
end;
Function FileSetDate (Const FileName : RawByteString; Age : Longint) : Longint;
Function FileSetDate (Const FileName : RawByteString; Age : Int64) : Longint;
var
SystemFileName: RawByteString;
t: TUTimBuf;

View File

@ -33,8 +33,8 @@ var
Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):ppchar;
function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):ppchar; // const ?
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint; deprecated 'use DateUtils.DateTimeToUnix';
Procedure EpochToLocal(epoch:longint;var year,month,day,hour,minute,second:Word); deprecated 'use DateUtils.UnixToDateTime';
Function LocalToEpoch(year,month,day,hour,minute,second:Word):int64; deprecated 'use DateUtils.DateTimeToUnix';
Procedure EpochToLocal(epoch:int64;var year,month,day,hour,minute,second:Word); deprecated 'use DateUtils.UnixToDateTime';
Procedure JulianToGregorian(JulianDN:LongInt;Var Year,Month,Day:Word); deprecated 'use DateUtils.DateTimetoJulianDate';
Function GregorianToJulian(Year,Month,Day:Longint):LongInt; deprecated 'use DateUtils.JulianDateToDateTime';
@ -175,7 +175,7 @@ Begin
Year:=YYear+(JulianDN*100);
end;
Procedure EpochToLocal(epoch:longint;var year,month,day,hour,minute,second:Word);
Procedure EpochToLocal(epoch:Int64;var year,month,day,hour,minute,second:Word);
{
Transforms Epoch time into local time (hour, minute,seconds)
}
@ -192,13 +192,13 @@ Begin
Second:=Epoch Mod 60;
End;
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Int64;
{
Transforms local time (year,month,day,hour,minutes,second) to Epoch time
(seconds since 00:00, january 1 1970, corrected for local time zone)
}
Begin
LocalToEpoch:=((GregorianToJulian(Year,Month,Day)-c1970)*86400)+
LocalToEpoch:=(Int64(GregorianToJulian(Year,Month,Day)-c1970)*86400)+
(LongInt(Hour)*3600)+(Longint(Minute)*60)+Second-TZSeconds;
End;

View File

@ -281,7 +281,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen(FileName, 0);
@ -424,7 +424,7 @@ begin
end;
Function FileSetDate (Handle, Age : Longint) : Longint;
Function FileSetDate (Handle, Age : Int64) : Longint;
var
Regs: registers;
begin

View File

@ -66,7 +66,7 @@ begin
end;
function FileSetDate(Handle, Age: LongInt) : LongInt;
function FileSetDate(Handle, Age: Int64) : LongInt;
begin
result := -1;
end;
@ -138,7 +138,7 @@ end;
(****** end of non portable routines ******)
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
begin
result := -1;
end;

View File

@ -394,7 +394,7 @@ begin
end;
Function FileAge (Const FileName : UnicodeString): Longint;
Function FileAge (Const FileName : UnicodeString): Int64;
var
Handle: THandle;
FindData: TWin32FindDataW;
@ -634,7 +634,7 @@ begin
Result:=-1;
end;
Function FileSetDate (Handle : THandle;Age : Longint) : Longint;
Function FileSetDate (Handle : THandle;Age : Int64) : Longint;
Var
FT: TFileTime;
begin
@ -646,7 +646,7 @@ begin
end;
{$IFDEF OS_FILESETDATEBYNAME}
Function FileSetDate (Const FileName : UnicodeString;Age : Longint) : Longint;
Function FileSetDate (Const FileName : UnicodeString;Age : Int64) : Longint;
Var
fd : THandle;
begin

View File

@ -315,7 +315,7 @@ begin
end;
Function FileAge (Const FileName : RawByteString): Longint;
Function FileAge (Const FileName : RawByteString): Int64;
var Handle: longint;
begin
Handle := FileOpen(FileName, 0);
@ -468,7 +468,7 @@ begin
end;
Function FileSetDate (Handle : THandle; Age : Longint) : Longint;
Function FileSetDate (Handle : THandle; Age : Int64) : Longint;
var
Regs: registers;
begin

View File

@ -250,7 +250,7 @@ begin
end;
Function FileAge (Const FileName : UnicodeString): Longint;
Function FileAge (Const FileName : UnicodeString): Int64;
var
Handle: THandle;
FindData: TWin32FindData;
@ -365,7 +365,7 @@ begin
end;
Function FileSetDate (Handle : THandle;Age : Longint) : Longint;
Function FileSetDate (Handle : THandle;Age : Int64) : Longint;
Var
FT: TFileTime;
begin

View File

@ -2238,7 +2238,7 @@ export LOG:=$(TEST_OUTPUTDIR)/log
endif
LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faillist
LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil
TESTDIRECTDIRS=
TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS))
TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2

View File

@ -154,7 +154,7 @@ LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faill
LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog
# Subdirs available in the test subdir
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil
TESTDIRECTDIRS=
TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS))
TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2

View File

@ -0,0 +1,15 @@
{ %target=linux,freebsd,openbsd,aix,darwin,netbsd }
uses
dateutils;
var
y,m,d,h,mn,s,s1000 : word;
begin
DecodeDateTime(UnixToDateTime(15796372693),y,m,d,h,mn,s,s1000);
if (y<>2470) or (m<>7) or (d<>26) or (h<>9) or (mn<>18) or (s<>13) or (s1000<>0) then
halt(1);
DecodeDateTime(UnixToDateTime(DateTimeToUnix(EncodeDateTime(2345,12,12,4,45,49,0))),y,m,d,h,mn,s,s1000);
if (y<>2345) or (m<>12) or (d<>12) or (h<>4) or (mn<>45) or (s<>49) or (s1000<>0) then
halt(1);
writeln('ok');
end.

View File

@ -0,0 +1,14 @@
{ %target=linux,freebsd,openbsd,aix,darwin,netbsd }
uses
unixutil;
var
y,m,d,h,mn,s : word;
begin
EpochToLocal(15796372693,y,m,d,h,mn,s);
if (y<>2470) or (m<>7) or (d<>26) or (h<>9) or (mn<>18) or (s<>13) then
halt(1);
EpochToLocal(LocalToEpoch(2345,12,12,4,45,49),y,m,d,h,mn,s);
if (y<>2345) or (m<>12) or (d<>12) or (h<>4) or (mn<>45) or (s<>49) then
halt(1);
writeln('ok');
end.