Skip to content
Snippets Groups Projects
Commit 3dba3c57 authored by Michal Vlasák's avatar Michal Vlasák
Browse files

Add support for MinGW

parent 9e369259
No related branches found
No related tags found
No related merge requests found
Pipeline #258514 passed
......@@ -24,6 +24,18 @@ int str_cmp(Str a, Str b)
return cmp == 0 ? (a.len > b.len) - (b.len > a.len) : cmp;
}
 
bool
time_get(struct timespec *ts)
{
#if defined(_WIN32) && defined(__MINGW32__)
return clock_gettime(CLOCK_REALTIME, ts) == 0;
#else
return timespec_get(ts, TIME_UTC) == TIME_UTC;
#endif
}
typedef struct {
const u8 *pos;
const u8 *end;
......
......@@ -10,6 +10,7 @@
#include <stdbool.h>
#include <stdalign.h>
#include <string.h>
#include <time.h>
 
#include "arena.h"
 
......@@ -45,6 +46,8 @@ bool str_eq(Str a, Str b);
// - a positive number if the first string is greater than the second
int str_cmp(Str a, Str b);
 
// Get current time and save it into `ts`.
bool time_get(struct timespec *ts);
 
// See https://courses.fit.cvut.cz/NI-RUN/specs/ast.html for details about the
// AST.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment