microseconds since 1970 (UNIX epoch) */
| 57 | |
| 58 | /* microseconds since 1970 (UNIX epoch) */ |
| 59 | static ulong64 epoch_usec(void) |
| 60 | { |
| 61 | #if defined(LTC_NO_TEST_TIMING) |
| 62 | return 0; |
| 63 | #elif defined(_WIN32) |
| 64 | FILETIME CurrentTime; |
| 65 | ulong64 cur_time; |
| 66 | ULARGE_INTEGER ul; |
| 67 | GetSystemTimeAsFileTime(&CurrentTime); |
| 68 | ul.LowPart = CurrentTime.dwLowDateTime; |
| 69 | ul.HighPart = CurrentTime.dwHighDateTime; |
| 70 | cur_time = ul.QuadPart; |
| 71 | cur_time -= CONST64(116444736000000000); /* subtract epoch in microseconds */ |
| 72 | cur_time /= 10; /* nanoseconds > microseconds */ |
| 73 | return cur_time; |
| 74 | #else |
| 75 | struct timeval tv; |
| 76 | gettimeofday(&tv, NULL); |
| 77 | return (ulong64)(tv.tv_sec) * 1000000 + (ulong64)(tv.tv_usec); /* get microseconds */ |
| 78 | #endif |
| 79 | } |
| 80 | |
| 81 | #ifdef LTC_PTHREAD |
| 82 | typedef struct |
no test coverage detected