mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
[JSMESS] Use emscripten_get_now() instead of gettimeofday() [clb] (nw)
This commit is contained in:
parent
1e800b70eb
commit
e5e7dc5b61
@ -15,6 +15,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef SDLMAME_EMSCRIPTEN
|
||||||
|
#include <emscripten.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sdlinc.h"
|
#include "sdlinc.h"
|
||||||
|
|
||||||
@ -29,6 +32,9 @@
|
|||||||
|
|
||||||
osd_ticks_t osd_ticks(void)
|
osd_ticks_t osd_ticks(void)
|
||||||
{
|
{
|
||||||
|
#ifdef SDLMAME_EMSCRIPTEN
|
||||||
|
return (osd_ticks_t)(emscripten_get_now() * 1000.0);
|
||||||
|
#else
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
static osd_ticks_t start_sec = 0;
|
static osd_ticks_t start_sec = 0;
|
||||||
|
|
||||||
@ -36,6 +42,7 @@ osd_ticks_t osd_ticks(void)
|
|||||||
if (start_sec==0)
|
if (start_sec==0)
|
||||||
start_sec = tp.tv_sec;
|
start_sec = tp.tv_sec;
|
||||||
return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
|
return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
osd_ticks_t osd_ticks_per_second(void)
|
osd_ticks_t osd_ticks_per_second(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user