remove second ifdefs for windows timing by introducing ported version of clock_gettime

This commit is contained in:
Aydyn Tairov
2023-07-27 15:38:45 +01:00
parent 79933a8ab4
commit acf1e18e8f
3 changed files with 16 additions and 9 deletions
+8
View File
@@ -176,3 +176,11 @@ int munlock(const void *addr, size_t len)
return -1;
}
// Portable clock_gettime function for Windows
int clock_gettime(int clk_id, struct timespec *tp) {
DWORD ticks = GetTickCount();
tp->tv_sec = ticks / 1000;
tp->tv_nsec = (ticks % 1000) * 1000000;
return 0;
}