diff --git a/src/main.c b/src/main.c index 94d7482..75c2d04 100644 --- a/src/main.c +++ b/src/main.c @@ -52,12 +52,6 @@ Color ne_processColor(unsigned int color) { return GetColor(color); } -double ne_timeProc(void *_) { - (void)_; - double t = GetTime(); - return (int)(t*100) / 100.0; -} - int keycode_to_oc(int keycode) { switch (keycode) { case KEY_NULL: @@ -561,8 +555,6 @@ int main(int argc, char **argv) { ctx.alloc = ne_sandbox_alloc; } - ctx.time = ne_timeProc; - SetConfigFlags(FLAG_WINDOW_RESIZABLE); InitWindow(800, 600, "NeoNucleus Test Emulator"); diff --git a/src/neonucleus.c b/src/neonucleus.c index 5109404..a41a94e 100644 --- a/src/neonucleus.c +++ b/src/neonucleus.c @@ -519,8 +519,14 @@ static void *nn_defaultAlloc(void *_, void *memory, size_t oldSize, size_t newSi static double nn_defaultTime(void *_) { #ifndef NN_BAREMETAL +#ifdef NN_POSIX + struct timespec s; + if(clock_gettime(CLOCK_REALTIME, &s)) return 0; + return s.tv_sec + (double)s.tv_nsec / 1000000000; +#else // time does not exist... yet! return 0; +#endif #else // time does not exist return 0;