- added Hal_getTimeInNs function for windows

pull/291/head
Michael Zillgith 5 years ago
parent 146dbb9057
commit 2baeb59e61

@ -27,6 +27,8 @@
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
/* Include the generated header with the model access handles */

@ -34,10 +34,26 @@ Hal_getTimeInMs()
uint64_t now;
static const uint64_t DIFF_TO_UNIXTIME = 11644473600000LL;
GetSystemTimeAsFileTime(&ft);
now = (LONGLONG)ft.dwLowDateTime + ((LONGLONG)(ft.dwHighDateTime) << 32LL);
return (now / 10000LL) - DIFF_TO_UNIXTIME;
}
nsSinceEpoch
Hal_getTimeInNs()
{
FILETIME ft;
static const uint64_t DIFF_TO_UNIXTIME = 11644473600000000000LL;
GetSystemTimeAsFileTime(&ft);
nsSinceEpoch nsTime = (LONGLONG)ft.dwLowDateTime + ((LONGLONG)(ft.dwHighDateTime) << 32LL);
nsTime = nsTime * 100LL - DIFF_TO_UNIXTIME;
return nsTime;
}

Loading…
Cancel
Save