Skip to content

Commit 00b92f4

Browse files
mkckr0azat
authored andcommitted
fix compile error in VS2012 in evutil_gettimeofday()
Move static variable definition before other statement, to prevent compile error in VS2012. Fixes: libevent#1135
1 parent d13b7bb commit 00b92f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

evutil_time.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ typedef void (WINAPI *GetSystemTimePreciseAsFileTime_fn_t) (LPFILETIME);
7171
int
7272
evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
7373
{
74+
static GetSystemTimePreciseAsFileTime_fn_t GetSystemTimePreciseAsFileTime_fn = NULL;
75+
static int check_precise = 1;
76+
7477
#ifdef _MSC_VER
7578
#define U64_LITERAL(n) n##ui64
7679
#else
@@ -93,9 +96,6 @@ evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
9396
if (tv == NULL)
9497
return -1;
9598

96-
static GetSystemTimePreciseAsFileTime_fn_t GetSystemTimePreciseAsFileTime_fn = NULL;
97-
static int check_precise = 1;
98-
9999
if (EVUTIL_UNLIKELY(check_precise)) {
100100
HMODULE h = evutil_load_windows_system_library_(TEXT("kernel32.dll"));
101101
if (h != NULL)

0 commit comments

Comments
 (0)