Skip to content

Commit d8fe8b9

Browse files
author
gojimmypi
committed
gettime_secs() in api.c now uses TimeNowInMilliseconds()
1 parent e303f87 commit d8fe8b9

1 file changed

Lines changed: 2 additions & 23 deletions

File tree

tests/api.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66387,28 +66387,7 @@ static const char* apitest_res_string(int res)
6638766387
#ifndef WOLFSSL_UNIT_TEST_NO_TIMING
6638866388
static double gettime_secs(void)
6638966389
{
66390-
#if defined(_MSC_VER) && defined(_WIN32)
66391-
{
66392-
/* there's no gettimeofday for Windows, so we'll use system time */
66393-
#define EPOCH_DIFF 11644473600LL
66394-
FILETIME currentFileTime;
66395-
GetSystemTimePreciseAsFileTime(&currentFileTime);
66396-
66397-
ULARGE_INTEGER uli = { 0, 0 };
66398-
uli.LowPart = currentFileTime.dwLowDateTime;
66399-
uli.HighPart = currentFileTime.dwHighDateTime;
66400-
66401-
/* Convert to seconds since Unix epoch */
66402-
return (double)((uli.QuadPart - EPOCH_DIFF * 10000000) / 10000000);
66403-
}
66404-
#else
66405-
{
66406-
struct timeval tv;
66407-
LIBCALL_CHECK_RET(gettimeofday(&tv, 0));
66408-
66409-
return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
66410-
}
66411-
#endif
66390+
return (double)(TimeNowInMilliseconds() / 1000.0);
6641266391
}
6641366392
#endif
6641466393

@@ -66478,7 +66457,7 @@ int ApiTest(void)
6647866457
#endif
6647966458
#ifndef WOLFSSL_UNIT_TEST_NO_TIMING
6648066459
if (ret != TEST_SKIPPED) {
66481-
printf(" %s (%9.5lf)\n", apitest_res_string(ret), timeDiff);
66460+
printf(" %s (%9.3lf)\n", apitest_res_string(ret), timeDiff);
6648266461
}
6648366462
else
6648466463
#endif

0 commit comments

Comments
 (0)