move epoch_usec() to test.c

This commit is contained in:
Steffen Jaeckel
2017-05-24 21:16:43 +02:00
parent f7d3c2bfa1
commit abe8d26246
3 changed files with 30 additions and 31 deletions
-1
View File
@@ -70,7 +70,6 @@ extern const struct ltc_prng_descriptor no_prng_desc;
int sorter(const void *a, const void *b);
void tally_results(int type);
ulong64 rdtsc (void);
ulong64 epoch_usec(void);
void t_start(void);
ulong64 t_read(void);
-30
View File
@@ -1,35 +1,5 @@
#include <tomcrypt_test.h>
#if defined(_WIN32)
#include <windows.h> /* GetSystemTimeAsFileTime */
#else
#include <sys/time.h>
#endif
/* microseconds since 1970 (UNIX epoch) */
ulong64 epoch_usec(void)
{
#if defined(LTC_NO_TEST_TIMING)
return 0;
#elif defined(_WIN32)
FILETIME CurrentTime;
ulong64 cur_time;
ULARGE_INTEGER ul;
GetSystemTimeAsFileTime(&CurrentTime);
ul.LowPart = CurrentTime.dwLowDateTime;
ul.HighPart = CurrentTime.dwHighDateTime;
cur_time = ul.QuadPart;
cur_time -= CONST64(116444736000000000); /* subtract epoch in microseconds */
cur_time /= 10; /* nanoseconds > microseconds */
return cur_time;
#else
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
return (ulong64)(tv.tv_sec) * 1000000 + (ulong64)(tv.tv_usec); /* get microseconds */
#endif
}
struct list results[100];
int no_results;
int sorter(const void *a, const void *b)