diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-25 17:00:06 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-25 17:01:50 -0800 |
commit | 2877208242cb3dd700d3e15282ef435801342751 (patch) | |
tree | 1b297f089c713db1be4d29899350b3d5f273d924 /system | |
parent | ed697ccbcd43f1dc72024c2157a1f8f6f18d9e96 (diff) |
make emscripten_get_now work in native builds, because what is otherwise a convenient way to just get timing info in ms using a simple libc call?
Diffstat (limited to 'system')
-rw-r--r-- | system/include/emscripten/emscripten.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index b6e6307b..fb456d67 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -227,7 +227,14 @@ void emscripten_get_canvas_size(int *width, int *height, int *isFullscreen); * absolute time, and is only meaningful in comparison to * other calls to this function. The unit is ms. */ +#if EMSCRIPTEN double emscripten_get_now(); +#else +#include <time.h> +double emscripten_get_now() { + return (1000*clock())/(double)CLOCKS_PER_SEC; +} +#endif /* * Simple random number generation in [0, 1), maps to Math.random(). |