Sfoglia il codice sorgente

* 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 -
(cherry picked from commit 01302bc47dd4a9c3cba94ccc738d103cc43120af)

florian 5 anni fa
parent
commit
3aadfc0802

+ 3 - 0
.gitattributes

@@ -1,3 +1,6 @@
 * text=auto !eol
 *.pp gitlab-language=pascal
 *.inc gitlab-language=pascal
+*.pp diff=pascal
+*.pas diff=pascal
+*.inc diff=pascal

+ 3 - 3
rtl/amicommon/sysutils.pp

@@ -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;

+ 3 - 3
rtl/atari/sysutils.pp

@@ -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

+ 1 - 1
rtl/embedded/sysutils.pp

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

+ 1 - 1
rtl/emx/sysutils.pp

@@ -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);

+ 2 - 2
rtl/gba/sysutils.pp

@@ -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;

+ 2 - 2
rtl/go32v2/sysutils.pp

@@ -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

+ 2 - 2
rtl/macos/sysutils.pp

@@ -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

+ 2 - 2
rtl/msdos/sysutils.pp

@@ -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

+ 2 - 2
rtl/nativent/sysutils.pp

@@ -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;

+ 2 - 2
rtl/nds/sysutils.pp

@@ -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;

+ 3 - 3
rtl/netware/sysutils.pp

@@ -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 }

+ 1 - 1
rtl/netware/tests/test.pas

@@ -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;

+ 1 - 1
rtl/netwlibc/sysutils.pp

@@ -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;

+ 2 - 2
rtl/objpas/sysutils/dati.inc

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

+ 2 - 2
rtl/objpas/sysutils/datih.inc

@@ -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;

+ 4 - 4
rtl/objpas/sysutils/filutil.inc

@@ -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;

+ 8 - 8
rtl/objpas/sysutils/filutilh.inc

@@ -49,7 +49,7 @@ Type
   { TUnicodeSearchRec }
 
   TUnicodeSearchRec = Record
-    Time : Longint;
+    Time : Int64;
     Size : Int64;
     Attr : Longint;
     Name : UnicodeString;
@@ -72,7 +72,7 @@ Type
   { TRawbyteSearchRec }
 
   TRawbyteSearchRec = Record
-    Time : Longint;
+    Time : Int64;
     Size : Int64;
     Attr : Longint;
     Name : RawByteString;
@@ -182,11 +182,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;
@@ -208,7 +208,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;
@@ -220,7 +220,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;
@@ -234,8 +234,8 @@ 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;
 

+ 3 - 3
rtl/objpas/sysutils/sysutils.inc

@@ -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}

+ 1 - 1
rtl/os2/sysutils.pp

@@ -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);

+ 2 - 2
rtl/symbian/sysutils.pp

@@ -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;

+ 4 - 4
rtl/unix/sysutils.pp

@@ -596,7 +596,7 @@ begin
     end;
 end;
 
-Function FileAge (Const FileName : RawByteString): Longint;
+Function FileAge (Const FileName : RawByteString): Int64;
 Var
   Info : Stat;
   SystemFileName: RawByteString;
@@ -1044,7 +1044,7 @@ Begin
 End;
 
 
-Function FileGetDate (Handle : Longint) : Longint;
+Function FileGetDate (Handle : Longint) : Int64;
 
 Var Info : Stat;
 
@@ -1056,7 +1056,7 @@ begin
 end;
 
 
-Function FileSetDate (Handle,Age : Longint) : Longint;
+Function FileSetDate (Handle : Longint;Age : Int64) : Longint;
 
 begin
   // Impossible under Linux from FileHandle !!
@@ -1114,7 +1114,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;

+ 5 - 5
rtl/unix/unixutil.pp

@@ -50,8 +50,8 @@ property Tzseconds : Longint read GetTzseconds;
 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';
 
@@ -202,7 +202,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)
 }
@@ -219,13 +219,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;
 

+ 2 - 2
rtl/watcom/sysutils.pp

@@ -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

+ 2 - 2
rtl/wii/sysutils.pp

@@ -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;

+ 3 - 3
rtl/win/sysutils.pp

@@ -394,7 +394,7 @@ begin
 end;
 
 
-Function FileAge (Const FileName : UnicodeString): Longint;
+Function FileAge (Const FileName : UnicodeString): Int64;
 var
   Handle: THandle;
   FindData: TWin32FindDataW;
@@ -653,7 +653,7 @@ begin
   Result:=-1;
 end;
 
-Function FileSetDate (Handle : THandle;Age : Longint) : Longint;
+Function FileSetDate (Handle : THandle;Age : Int64) : Longint;
 Var
   FT: TFileTime;
 begin
@@ -665,7 +665,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

+ 2 - 2
rtl/win16/sysutils.pp

@@ -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

+ 2 - 2
rtl/wince/sysutils.pp

@@ -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

+ 1 - 1
tests/Makefile

@@ -2219,7 +2219,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
+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

+ 1 - 1
tests/Makefile.fpc

@@ -159,7 +159,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
+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

+ 15 - 0
tests/test/units/dateutil/tunitdt1.pp

@@ -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.

+ 14 - 0
tests/test/units/unixutil/tepoch1.pp

@@ -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.