|
| 1 | +diff --git a/win32/dllmain.c b/win32/dllmain.c |
| 2 | +index a507f1e1..ab625bf3 100644 |
| 3 | +--- a/win32/dllmain.c |
| 4 | ++++ b/win32/dllmain.c |
| 5 | +@@ -38,20 +38,6 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID dummy) |
| 6 | + switch (reason) |
| 7 | + { |
| 8 | + case DLL_PROCESS_ATTACH: |
| 9 | +- /* |
| 10 | +- * We do not need to check the return value of php_win32_init_gettimeofday() |
| 11 | +- * because the symbol bare minimum symbol we need is always available on our |
| 12 | +- * lowest supported platform. |
| 13 | +- * |
| 14 | +- * On Windows 8 or greater, we use a more precise symbol to obtain the system |
| 15 | +- * time, which is dynamically. The fallback allows us to proper support |
| 16 | +- * Vista/7/Server 2003 R2/Server 2008/Server 2008 R2. |
| 17 | +- * |
| 18 | +- * Instead simply initialize the global in win32/time.c for gettimeofday() |
| 19 | +- * use later on |
| 20 | +- */ |
| 21 | +- php_win32_init_gettimeofday(); |
| 22 | +- |
| 23 | + ret = ret && php_win32_ioutil_init(); |
| 24 | + if (!ret) { |
| 25 | + fprintf(stderr, "ioutil initialization failed"); |
| 26 | +diff --git a/win32/time.c b/win32/time.c |
| 27 | +index d1fe5145..57db914e 100644 |
| 28 | +--- a/win32/time.c |
| 29 | ++++ b/win32/time.c |
| 30 | +@@ -23,42 +23,13 @@ |
| 31 | + #include <errno.h> |
| 32 | + #include "php_win32_globals.h" |
| 33 | + |
| 34 | +-typedef VOID (WINAPI *MyGetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime); |
| 35 | +- |
| 36 | +-static MyGetSystemTimeAsFileTime timefunc = NULL; |
| 37 | +- |
| 38 | +-#ifdef PHP_EXPORTS |
| 39 | +-static zend_always_inline MyGetSystemTimeAsFileTime get_time_func(void) |
| 40 | +-{/*{{{*/ |
| 41 | +- MyGetSystemTimeAsFileTime timefunc = NULL; |
| 42 | +- HMODULE hMod = GetModuleHandle("kernel32.dll"); |
| 43 | +- |
| 44 | +- if (hMod) { |
| 45 | +- /* Max possible resolution <1us, win8/server2012 */ |
| 46 | +- timefunc = (MyGetSystemTimeAsFileTime)GetProcAddress(hMod, "GetSystemTimePreciseAsFileTime"); |
| 47 | +- } |
| 48 | +- |
| 49 | +- if(!timefunc) { |
| 50 | +- /* 100ns blocks since 01-Jan-1641 */ |
| 51 | +- timefunc = (MyGetSystemTimeAsFileTime) GetSystemTimeAsFileTime; |
| 52 | +- } |
| 53 | +- |
| 54 | +- return timefunc; |
| 55 | +-}/*}}}*/ |
| 56 | +- |
| 57 | +-void php_win32_init_gettimeofday(void) |
| 58 | +-{/*{{{*/ |
| 59 | +- timefunc = get_time_func(); |
| 60 | +-}/*}}}*/ |
| 61 | +-#endif |
| 62 | +- |
| 63 | + static zend_always_inline int getfilesystemtime(struct timeval *tv) |
| 64 | + {/*{{{*/ |
| 65 | + FILETIME ft; |
| 66 | + unsigned __int64 ff = 0; |
| 67 | + ULARGE_INTEGER fft; |
| 68 | + |
| 69 | +- timefunc(&ft); |
| 70 | ++ GetSystemTimePreciseAsFileTime(&ft); |
| 71 | + |
| 72 | + /* |
| 73 | + * Do not cast a pointer to a FILETIME structure to either a |
| 74 | +diff --git a/win32/time.h b/win32/time.h |
| 75 | +index 51090ccf..77d1cbfd 100644 |
| 76 | +--- a/win32/time.h |
| 77 | ++++ b/win32/time.h |
| 78 | +@@ -54,10 +54,4 @@ PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp ); |
| 79 | + |
| 80 | + PHPAPI int usleep(unsigned int useconds); |
| 81 | + |
| 82 | +-#ifdef PHP_EXPORTS |
| 83 | +-/* This symbols are needed only for the DllMain, but should not be exported |
| 84 | +- or be available when used with PHP binaries. */ |
| 85 | +-void php_win32_init_gettimeofday(void); |
| 86 | +-#endif |
| 87 | +- |
| 88 | + #endif |
0 commit comments