Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,12 +937,19 @@ uint64_t js__hrtime_ns(void) {
}
#else
uint64_t js__hrtime_ns(void) {
#ifdef __DJGPP
struct timeval tv;
if (gettimeofday(&tv, NULL))
abort();
return tv.tv_sec * NANOSEC + tv.tv_usec * 1000;
#else
struct timespec t;

if (clock_gettime(CLOCK_MONOTONIC, &t))
abort();

return t.tv_sec * NANOSEC + t.tv_nsec;
#endif
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
#elif defined(_WIN32)
#include <windows.h>
#endif
#if !defined(_WIN32) && !defined(EMSCRIPTEN) && !defined(__wasi__)
#if !defined(_WIN32) && !defined(EMSCRIPTEN) && !defined(__wasi__) && !defined(__DJGPP)
#include <errno.h>
#include <pthread.h>
#endif
Expand Down Expand Up @@ -578,7 +578,7 @@ int js_exepath(char* buffer, size_t* size);

/* Cross-platform threading APIs. */

#if defined(EMSCRIPTEN) || defined(__wasi__)
#if defined(EMSCRIPTEN) || defined(__wasi__) || defined(__DJGPP)

#define JS_HAVE_THREADS 0

Expand Down
3 changes: 1 addition & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <intrin.h>
#endif
#include <time.h>
#include <fenv.h>
#include <math.h>

#include "cutils.h"
Expand Down Expand Up @@ -68,7 +67,7 @@
// atomic_store etc. are completely busted in recent versions of tcc;
// somehow the compiler forgets to load |ptr| into %rdi when calling
// the __atomic_*() helpers in its lib/stdatomic.c and lib/atomic.S
#if !defined(__TINYC__) && !defined(EMSCRIPTEN) && !defined(__wasi__) && !__STDC_NO_ATOMICS__
#if !defined(__TINYC__) && !defined(EMSCRIPTEN) && !defined(__wasi__) && !__STDC_NO_ATOMICS__ && !defined(__DJGPP)
#include "quickjs-c-atomics.h"
#define CONFIG_ATOMICS
#endif
Expand Down