]> granicus.if.org Git - php/commitdiff
We do not need to check the return value of php_win32_init_gettimeofday() anymore...
authorKalle Sommer Nielsen <kalle@php.net>
Thu, 11 Aug 2016 02:35:51 +0000 (04:35 +0200)
committerKalle Sommer Nielsen <kalle@php.net>
Thu, 11 Aug 2016 02:35:51 +0000 (04:35 +0200)
win32/dllmain.c
win32/time.c
win32/time.h

index 37408f1e768da93e3322f60df7a160db346060bd..ab4f105528e87b18e35295a8ced1dba156d3bc5c 100644 (file)
@@ -40,11 +40,19 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID dummy)
        switch (reason)
        {
                case DLL_PROCESS_ATTACH:
-                       ret = ret && php_win32_init_gettimeofday();
-                       if (!ret) {
-                               fprintf(stderr, "gettimeofday() initialization failed");
-                               return ret;
-                       }
+                       /*
+                        * We do not need to check the return value of php_win32_init_gettimeofday()
+                        * because the symbol bare minimum symbol we need is always available on our 
+                        * lowest supported platform.
+                        *
+                        * On Windows 8 or greater, we use a more precise symbol to obtain the system
+                        * time, which is dynamically. The fallback allows us to proper support 
+                        * Vista/7/Server 2003 R2/Server 2008/Server 2008 R2.
+                        *
+                        * Instead simply initialize the global in win32/time.c for gettimeofday()
+                        * use later on
+                        */
+                       php_win32_init_gettimeofday();
 
                        ret = ret && php_win32_ioutil_init();
                        if (!ret) {
index dcc0943ec4062c649c6d8106e45a7081a653f615..a0ed1b344ec08b177472dc99c267d8987f2d0092 100644 (file)
@@ -51,11 +51,9 @@ static zend_always_inline MyGetSystemTimeAsFileTime get_time_func(void)
        return timefunc;
 }
 
-BOOL php_win32_init_gettimeofday(void)
+void php_win32_init_gettimeofday(void)
 {
        timefunc = get_time_func();
-
-       return (NULL != timefunc);
 }
 #endif
 
index b46c1675ca5642a295f7167af74ba4dce83ec1ce..865e299aa94a7200732d5971304d803e3b4a6cc7 100644 (file)
@@ -55,7 +55,7 @@ PHPAPI int usleep(unsigned int useconds);
 #ifdef PHP_EXPORTS
 /* This symbols are needed only for the DllMain, but should not be exported 
        or be available when used with PHP binaries. */
-BOOL php_win32_init_gettimeofday(void);
+void php_win32_init_gettimeofday(void);
 #endif
 
 #endif