[fpc-devel] libc patch

petr.kristan at epos.cz petr.kristan at epos.cz
Tue Mar 18 09:00:37 CET 2008


Improved Borland compatibility and 64-bit portability in time functions.


Index: packages/libc/src/glue.inc
===================================================================
--- packages/libc/src/glue.inc	(revision 10498)
+++ packages/libc/src/glue.inc	(working copy)
@@ -26,8 +26,8 @@
   __sighandler_t = procedure(SigNum: Integer); cdecl;
 
   timespec = record
-    tv_sec: Longint;
-    tv_nsec: Longint;
+    tv_sec: ValSInt;
+    tv_nsec: ValSInt;
   end;
 
   wint_t = Cardinal;
Index: packages/libc/src/typesh.inc
===================================================================
--- packages/libc/src/typesh.inc	(revision 10498)
+++ packages/libc/src/typesh.inc	(working copy)
@@ -42,9 +42,9 @@
    __useconds_t = dword;
    __suseconds_t = longint;
    __swblk_t = longint;
-   __clock_t = longint;
+   __clock_t = SizeInt;
    __clockid_t = longint;
-   __timer_t = longint;
+   __timer_t = SizeInt;
    __fd_mask = dWord;
 
 const
Index: packages/libc/src/timeh.inc
===================================================================
--- packages/libc/src/timeh.inc	(revision 10498)
+++ packages/libc/src/timeh.inc	(working copy)
@@ -25,8 +25,8 @@
         tm_yday : longint;
         tm_isdst : longint;
         case boolean of 
-         false : (tm_gmtoff : longint;tm_zone : Pchar);
-         true  : (__tm_gmtoff : longint;__tm_zone : Pchar);
+         false : (tm_gmtoff : ValSInt;tm_zone : Pchar);
+         true  : (__tm_gmtoff : ValSInt;__tm_zone : Pchar);
 	end;
 
    Pitimerspec = ^itimerspec;
@@ -84,29 +84,23 @@
 
   TITimerSpec = itimerspec;
 
-function __time(var __timer : ttime_t):time_t;cdecl;external clib name 'time';
 function mktime(var __tp:tm):time_t;cdecl;external clib name 'mktime';
 function strftime(__s:Pchar; __maxsize:size_t; __format:Pchar; var __tp:tm):size_t;cdecl;external clib name 'strftime';
 function strptime(__s:Pchar; __fmt:Pchar; var __tp: tm):Pchar;cdecl;external clib name 'strptime';
-function gmtime(var __timer : ttime_t):Ptm;cdecl;external clib name 'gmtime';
-function localtime(var __timer : ttime_t):Ptm;cdecl;external clib name 'localtime';
-function gmtime_r(var __timer : ttime_t; var __tp:tm):Ptm;cdecl;external clib name 'gmtime_r';
-function localtime_r(var __timer : ttime_t; var __tp: tm):Ptm;cdecl;external clib name 'localtime_r';
+function gmtime_r(__timer : Ptime_t; var __tp:tm):Ptm;cdecl;external clib name 'gmtime_r';
+function localtime_r(__timer : Ptime_t; var __tp: tm):Ptm;cdecl;external clib name 'localtime_r';
 function asctime(var __tp: tm):Pchar;cdecl;external clib name 'asctime';
-function ctime(var __timer : ttime_t):Pchar;cdecl;external clib name 'ctime';
 function asctime_r(var __tp:tm; __buf:Pchar):Pchar;cdecl;external clib name 'asctime_r';
-function ctime_r(var __timer : ttime_t; __buf:Pchar):Pchar;cdecl;external clib name 'ctime_r';
 
-function stime(var __when : ttime_t):longint;cdecl;external clib name 'stime';
 function timegm(var __tp:tm):time_t;cdecl;external clib name 'timegm';
 function timelocal(var __tp: tm):time_t;cdecl;external clib name 'timelocal';
-function nanosleep(var __requested_time : ttimespec; var __remaining : ttimespec):longint;cdecl;external clib name 'nanosleep';
-function clock_getres(var __clock_id:clockid_t; __res : ttimespec):longint;cdecl;external clib name 'clock_getres';
-function clock_gettime(var __clock_id:clockid_t; __tp : ttimespec):longint;cdecl;external clib name 'clock_gettime';
-function clock_settime(var __clock_id:clockid_t; __tp : ttimespec):longint;cdecl;external clib name 'clock_settime';
-function clock_nanosleep(var __clock_id:clockid_t; __flags:longint; __req : ttimespec; var __rem : ttimespec):longint;cdecl;external clib name 'clock_nanosleep';
+function nanosleep(var __requested_time : ttimespec; __remaining : Ptimespec):longint;cdecl;external clib name 'nanosleep';
+function clock_getres(__clock_id:clockid_t; var __res : ttimespec):longint;cdecl;external clib name 'clock_getres';
+function clock_gettime(__clock_id:clockid_t; var __tp : ttimespec):longint;cdecl;external clib name 'clock_gettime';
+function clock_settime(__clock_id:clockid_t; var __tp : ttimespec):longint;cdecl;external clib name 'clock_settime';
+function clock_nanosleep(__clock_id:clockid_t; __flags:longint; __req : ttimespec; var __rem : ttimespec):longint;cdecl;external clib name 'clock_nanosleep';
 function clock_getcpuclockid(__pid:pid_t; var __clock_id: tclockid_t):longint;cdecl;external clib name 'clock_getcpuclockid';
 function timer_create(__clock_id:clockid_t; var __ev :tsigevent; var __timerid:timer_t):longint;cdecl;external clib name 'timer_create';
-function timer_settime(__timerid:timer_t; __flags:longint; const __value: titimerspec; var __ovalue:titimerspec):longint;cdecl;external clib name 'timer_settime';
+function timer_settime(__timerid:timer_t; __flags:longint; const __value: titimerspec; __ovalue:Pitimerspec):longint;cdecl;external clib name 'timer_settime';
 function timer_gettime(__timerid:timer_t; var __value: titimerspec):longint;cdecl;external clib name 'timer_gettime';
 
-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709



More information about the fpc-devel mailing list