File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66471,12 +66471,28 @@ static const char* apitest_res_string(int res)
6647166471
6647266472#ifndef WOLFSSL_UNIT_TEST_NO_TIMING
6647366473static double gettime_secs(void)
66474- {
66475- struct timeval tv;
66476- LIBCALL_CHECK_RET(gettimeofday(&tv, 0));
66474+ #if defined(_MSC_VER) && defined(_WIN32)
66475+ {
66476+ /* there's no gettimeofday for Windows, so we'll use system time */
66477+ #define EPOCH_DIFF 11644473600LL
66478+ FILETIME currentFileTime;
66479+ GetSystemTimePreciseAsFileTime(¤tFileTime);
6647766480
66478- return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
66479- }
66481+ ULARGE_INTEGER uli = { 0, 0 };
66482+ uli.LowPart = currentFileTime.dwLowDateTime;
66483+ uli.HighPart = currentFileTime.dwHighDateTime;
66484+
66485+ /* Convert to seconds since Unix epoch */
66486+ return (double)((uli.QuadPart - (EPOCH_DIFF * 10000000)) / 10000000.0);
66487+ }
66488+ #else
66489+ {
66490+ struct timeval tv;
66491+ LIBCALL_CHECK_RET(gettimeofday(&tv, 0));
66492+
66493+ return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
66494+ }
66495+ #endif
6648066496#endif
6648166497
6648266498int ApiTest(void)
You can’t perform that action at this time.
0 commit comments