Skip to content

Commit c62fb87

Browse files
committed
fix the windows compa
1 parent 12f6a3f commit c62fb87

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,23 @@ static const char* find_bundled_libc(void) {
8787

8888
return NULL;
8989
}
90+
#ifdef _WIN32
91+
#include <windows.h>
92+
struct timespec {
93+
time_t tv_sec;
94+
long tv_nsec;
95+
};
96+
97+
static int clock_gettime(int unused, struct timespec *ts) {
98+
LARGE_INTEGER freq, counter;
99+
QueryPerformanceFrequency(&freq);
100+
QueryPerformanceCounter(&counter);
101+
ts->tv_sec = counter.QuadPart / freq.QuadPart;
102+
ts->tv_nsec = (counter.QuadPart % freq.QuadPart) * 1000000000 / freq.QuadPart;
103+
return 0;
104+
}
105+
#define CLOCK_MONOTONIC 1
106+
#endif
90107
int main(int argc, char **argv) {
91108
if (argc < 2) {
92109
fprintf(stderr, "OVERVIEW: Vix Compiler\n\n");

0 commit comments

Comments
 (0)