diff options
Diffstat (limited to 'gnulib/import/gettimeofday.c')
-rw-r--r-- | gnulib/import/gettimeofday.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gnulib/import/gettimeofday.c b/gnulib/import/gettimeofday.c index b63f8f29292..057cebdb163 100644 --- a/gnulib/import/gettimeofday.c +++ b/gnulib/import/gettimeofday.c @@ -33,9 +33,15 @@ #ifdef WINDOWS_NATIVE +/* Don't assume that UNICODE is not defined. */ +# undef LoadLibrary +# define LoadLibrary LoadLibraryA + +# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) + /* Avoid warnings from gcc -Wcast-function-type. */ -# define GetProcAddress \ - (void *) GetProcAddress +# define GetProcAddress \ + (void *) GetProcAddress /* GetSystemTimePreciseAsFileTime was introduced only in Windows 8. */ typedef void (WINAPI * GetSystemTimePreciseAsFileTimeFuncType) (FILETIME *lpTime); @@ -54,6 +60,12 @@ initialize (void) initialized = TRUE; } +# else + +# define GetSystemTimePreciseAsFileTimeFunc GetSystemTimePreciseAsFileTime + +# endif + #endif /* This is a wrapper for gettimeofday. It is used only on systems @@ -84,8 +96,10 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) <http://www.windowstimestamp.com/description>. */ FILETIME current_time; +# if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) if (!initialized) initialize (); +# endif if (GetSystemTimePreciseAsFileTimeFunc != NULL) GetSystemTimePreciseAsFileTimeFunc (¤t_time); else |