diff options
| author | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2021-04-22 11:04:01 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 11:04:01 +0300 |
| commit | b20bdb01d9da65bcffac57e116044060836142d1 (patch) | |
| tree | a8680595fd82f9ad406d1f2d5a90c8e623ced1a4 /fixtest/hiclock.c | |
| parent | 24488b16cc0359daada0682a9bd3a11a801d0a01 (diff) | |
| parent | 17a6197819236bc9ca9eb8826bfd3b18e63ddabd (diff) | |
| download | libfixmath-b20bdb01d9da65bcffac57e116044060836142d1.tar.gz | |
Merge pull request #25 from maruncz/master
Added CMakeLists.txt and some fixes
Diffstat (limited to 'fixtest/hiclock.c')
| -rw-r--r-- | fixtest/hiclock.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fixtest/hiclock.c b/fixtest/hiclock.c index 94ed735..5ce58df 100644 --- a/fixtest/hiclock.c +++ b/fixtest/hiclock.c @@ -1,25 +1,28 @@ #include "hiclock.h"
+#include <stddef.h>
#if defined(__WIN32) || defined(__WIN64)
LONGLONG HICLOCKS_PER_SEC = 0;
-void hiclock_init() {
+void hiclock_init()
+{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
HICLOCKS_PER_SEC = freq.QuadPart;
}
#endif
-hiclock_t hiclock() {
- #if defined(__unix__)
- timeval clocks;
+hiclock_t hiclock()
+{
+#if defined(__unix__)
+ struct timeval clocks;
gettimeofday(&clocks, NULL);
return ((uint64_t)clocks.tv_sec * 1000000ULL) + clocks.tv_usec;
- #elif defined(__WIN32) || defined(__WIN64)
+#elif defined(__WIN32) || defined(__WIN64)
LARGE_INTEGER clocks;
QueryPerformanceCounter(&clocks);
return clocks.QuadPart;
- #else
+#else
return clock();
- #endif
+#endif
}
|
