diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c index cd7fde8555..6a3678f0a1 100644 --- a/src/lib/evil/evil_main.c +++ b/src/lib/evil/evil_main.c @@ -11,19 +11,14 @@ static int _evil_init_count = 0; extern LONGLONG _evil_time_freq; extern LONGLONG _evil_time_count; -extern long _evil_time_second; extern DWORD _evil_tls_index; -long _evil_systemtime_to_time(SYSTEMTIME st); - int evil_init(void) { - SYSTEMTIME st; LARGE_INTEGER freq; LARGE_INTEGER count; - WORD second = 59; if (++_evil_init_count != 1) return _evil_init_count; @@ -39,30 +34,11 @@ evil_init(void) } } - if (!QueryPerformanceFrequency(&freq)) - return 0; + QueryPerformanceFrequency(&freq); _evil_time_freq = freq.QuadPart; - /* be sure that second + 1 != 0 */ - while (second == 59) - { - GetSystemTime(&st); - second = st.wSecond; - } - - /* retrieve the tick corresponding to the time we retrieve above */ - while (1) - { - GetSystemTime(&st); - QueryPerformanceCounter(&count); - if (st.wSecond == second + 1) - break; - } - - _evil_time_second = _evil_systemtime_to_time(st); - if (_evil_time_second < 0) - return --_evil_init_count; + QueryPerformanceCounter(&count); _evil_time_count = count.QuadPart; diff --git a/src/lib/evil/evil_main.h b/src/lib/evil/evil_main.h index 44b8356e4d..40fd38f15f 100644 --- a/src/lib/evil/evil_main.h +++ b/src/lib/evil/evil_main.h @@ -93,9 +93,8 @@ * @brief Initialize the Evil library. * * This function initializes the Evil library. It must be called before - * using evil_time_get(), gettimeofday() or pipe(). It returns 0 on - * failure, otherwise it returns the number of times it has already been - * called. + * using evil_time_get() or pipe(). It returns 0 on failure, otherwise it + * returns the number of times it has already been called. * * When Evil is not used anymore, call evil_shutdown() to shut down * the Evil library. diff --git a/src/lib/evil/evil_unistd.c b/src/lib/evil/evil_unistd.c index 3eebf97e1e..535ef71231 100644 --- a/src/lib/evil/evil_unistd.c +++ b/src/lib/evil/evil_unistd.c @@ -17,34 +17,6 @@ LONGLONG _evil_time_freq; LONGLONG _evil_time_count; -long _evil_time_second; - - -long _evil_systemtime_to_time(SYSTEMTIME st); - -long -_evil_systemtime_to_time(SYSTEMTIME st) -{ - int days[] = { - -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 - }; - int day; - time_t t; - - st.wYear -= 1900; - if ((st.wYear < 70) || (st.wYear > 138)) - return -1; - - day = st.wDay + days[st.wMonth - 1]; - - if (!(st.wYear & 3) && (st.wMonth > 2) ) - day++; - - t = ((st.wYear - 70) * 365 + ((st.wYear - 1) >> 2) - 17 + day) * 24 + st.wHour; - t = (t * 60 + st.wMinute) * 60 + st.wSecond; - - return (long)t; -} /* * Time related functions @@ -58,7 +30,7 @@ evil_time_get(void) QueryPerformanceCounter(&count); - return (double)_evil_time_second + (double)(count.QuadPart - _evil_time_count)/ (double)_evil_time_freq; + return (double)(count.QuadPart - _evil_time_count)/ (double)_evil_time_freq; }