MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / epoch_usec

Function epoch_usec

extern/libtomcrypt/tests/test.c:59–79  ·  view source on GitHub ↗

microseconds since 1970 (UNIX epoch) */

Source from the content-addressed store, hash-verified

57
58/* microseconds since 1970 (UNIX epoch) */
59static 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
82typedef struct

Callers 2

runFunction · 0.85
mainFunction · 0.85

Calls 2

GetSystemTimeAsFileTimeFunction · 0.85
gettimeofdayFunction · 0.85

Tested by

no test coverage detected