This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
30
unikernel/duniverse/eqaf/clock/clock_windows_stubs.c
Normal file
30
unikernel/duniverse/eqaf/clock/clock_windows_stubs.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <caml/alloc.h>
|
||||
#include <caml/memory.h>
|
||||
#include <caml/misc.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static LARGE_INTEGER frequency;
|
||||
|
||||
CAMLprim value
|
||||
clock_windows_init(value unit)
|
||||
{
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
frequency.QuadPart = 1000000000L / frequency.QuadPart;
|
||||
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
CAMLprim value
|
||||
clock_windows_get_time(value unit)
|
||||
{
|
||||
CAMLparam0();
|
||||
CAMLlocal1(res);
|
||||
LARGE_INTEGER now;
|
||||
|
||||
QueryPerformanceCounter(&now);
|
||||
|
||||
res = caml_copy_int64(now.QuadPart * frequency.QuadPart);
|
||||
|
||||
CAMLreturn(res);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue