summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rtl/objpas/sysutils/dati.inc14
-rw-r--r--rtl/unix/sysutils.pp2
2 files changed, 15 insertions, 1 deletions
diff --git a/rtl/objpas/sysutils/dati.inc b/rtl/objpas/sysutils/dati.inc
index b7c2cad4f7..97c44ceb40 100644
--- a/rtl/objpas/sysutils/dati.inc
+++ b/rtl/objpas/sysutils/dati.inc
@@ -720,6 +720,7 @@ Var YY,MM,DD,H,m,s,msec : Word;
begin
Decodedate (DateTime,YY,MM,DD);
+{$ifndef unix}
If (YY<1980) or (YY>2099) then
Result:=0
else
@@ -728,11 +729,16 @@ begin
Result:=(s shr 1) or (m shl 5) or (h shl 11);
Result:=Result or DD shl 16 or (MM shl 21) or ((YY-1980) shl 25);
end;
+{$else unix}
+ Decodetime(DateTime,h,m,s,msec);
+ Result:=LocalToEpoch(yy,mm,dd,h,m,s);
+{$endif unix}
end;
Function FileDateToDateTime (Filedate : Longint) : TDateTime;
+{$ifndef unix}
Var Date,Time : Word;
begin
@@ -741,6 +747,14 @@ begin
Result:=EncodeDate((Date shr 9) + 1980,(Date shr 5) and 15, Date and 31) +
EncodeTime(Time shr 11, (Time shr 5) and 63, (Time and 31) shl 1,0);
end;
+{$else unix}
+var
+ y, mon, d, h, min, s: word;
+begin
+ EpochToLocal(FileDate,y,mon,d,h,min,s);
+ Result:=EncodeDate(y,mon,d) + EncodeTime(h,min,s,0);
+end;
+{$endif unix}
function TryStrToDate(const S: string; out Value: TDateTime): Boolean;
diff --git a/rtl/unix/sysutils.pp b/rtl/unix/sysutils.pp
index 6c9020a98a..a6ac2a68e8 100644
--- a/rtl/unix/sysutils.pp
+++ b/rtl/unix/sysutils.pp
@@ -40,7 +40,7 @@ Procedure AddDisk(const path:string);
implementation
Uses
- {$ifdef FPC_USE_LIBC}initc{$ELSE}Syscall{$ENDIF}, Baseunix;
+ {$ifdef FPC_USE_LIBC}initc{$ELSE}Syscall{$ENDIF}, Baseunix, unixutil;
{$Define OS_FILEISREADONLY} // Specific implementation for Unix.