cvs: pecl /apd win32compat.c

From: Date: Thu, 11 Mar 2004 06:37:21 +0000
Subject: cvs: pecl /apd win32compat.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-1054@lists.php.net to get a copy of this message
sebastian Thu Mar 11 01:37:21 2004 EDT Modified files: /pecl/apd win32compat.c Log: Make apd build on Windows by removing code that has been added to php-src/win32/time.c (see http://cvs.php.net/diff.php/php-src/win32/time.c?login=2&r1=1.4&r2=1.5&ty=u). http://cvs.php.net/diff.php/pecl/apd/win32compat.c?r1=1.6&r2=1.7&ty=u Index: pecl/apd/win32compat.c diff -u pecl/apd/win32compat.c:1.6 pecl/apd/win32compat.c:1.7 --- pecl/apd/win32compat.c:1.6 Wed Mar 10 11:40:55 2004 +++ pecl/apd/win32compat.c Thu Mar 11 01:37:20 2004 @@ -12,16 +12,10 @@ * * *****************************************************************************/ -/* $Id: win32compat.c,v 1.6 2004/03/10 16:40:55 gschlossnagle Exp $ */ +/* $Id: win32compat.c,v 1.7 2004/03/11 06:37:20 sebastian Exp $ */ #include "win32compat.h" - /** - * - * 04-Feb-2001 - * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi> - * Improves accuracy of msec - */ int FiletimeToTimeval(FILETIME ft, struct timeval *time_Info) { __int64 ff; @@ -32,98 +26,6 @@ return 0; } - -int getfilesystemtime(struct timeval *time_Info) -{ - FILETIME ft; - - GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ - /* resolution seems to be 0.01 sec */ - return FiletimeToTimeval(ft,time_Info); -} - -int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info) -{ - - static struct timeval starttime = {0, 0}; - static __int64 lasttime = 0; - static __int64 freq = 0; - __int64 timer; - LARGE_INTEGER li; - BOOL b; - double dt; - - /* Get the time, if they want it */ - if (time_Info != NULL) { - if (starttime.tv_sec == 0) { - b = QueryPerformanceFrequency(&li); - if (!b) { - starttime.tv_sec = -1; - } - else { - freq = li.QuadPart; - b = QueryPerformanceCounter(&li); - if (!b) { - starttime.tv_sec = -1; - } - else { - getfilesystemtime(&starttime); - timer = li.QuadPart; - dt = (double)timer/freq; - starttime.tv_usec -= (int)((dt-(int)dt)*1000000); - if (starttime.tv_usec < 0) { - starttime.tv_usec += 1000000; - --starttime.tv_sec; - } - starttime.tv_sec -= (int)dt; - } - } - } - if (starttime.tv_sec > 0) { - b = QueryPerformanceCounter(&li); - if (!b) { - starttime.tv_sec = -1; - } - else { - timer = li.QuadPart; - if (timer < lasttime) { - getfilesystemtime(time_Info); - dt = (double)timer/freq; - starttime = *time_Info; - starttime.tv_usec -= (int)((dt-(int)dt)*1000000); - if (starttime.tv_usec < 0) { - starttime.tv_usec += 1000000; - --starttime.tv_sec; - } - starttime.tv_sec -= (int)dt; - } - else { - lasttime = timer; - dt = (double)timer/freq; - time_Info->tv_sec = starttime.tv_sec + (int)dt; - time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000); - if (time_Info->tv_usec > 1000000) { - time_Info->tv_usec -= 1000000; - ++time_Info->tv_sec; - } - } - } - } - if (starttime.tv_sec < 0) { - getfilesystemtime(time_Info); - } - - } - /* Get the timezone, if they want it - if (timezone_Info != NULL) { - _tzset(); - timezone_Info->tz_minuteswest = _timezone; - timezone_Info->tz_dsttime = _daylight; - } - And return */ - return 0; -} - clock_t times (struct tms *__buffer) { HANDLE cp;

« previous php.pecl.cvs (#1054) next »