Skip to content

Commit

Permalink
Merge pull request #2803 from DenizUgur/master
Browse files Browse the repository at this point in the history
fix time source for wasm
  • Loading branch information
jeanlf committed Apr 16, 2024
2 parents e7b07d4 + 8a0f55c commit 87efbf2
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/utils/os_divers.c
Expand Up @@ -133,7 +133,7 @@ u32 gf_gpac_abi_micro()
}


#ifndef WIN32
#if !defined(WIN32) && !defined(GPAC_CONFIG_EMSCRIPTEN)

GF_EXPORT
u32 gf_sys_clock()
Expand All @@ -153,6 +153,23 @@ u64 gf_sys_clock_high_res()

#endif

#ifdef GPAC_CONFIG_EMSCRIPTEN
#include <emscripten/emscripten.h>

GF_EXPORT
u32 gf_sys_clock()
{
return (u32)(emscripten_get_now() - sys_start_time);
}

GF_EXPORT
u64 gf_sys_clock_high_res()
{
return (long long)(emscripten_get_now() * 1000.0) - sys_start_time_hr;
}

#endif

Bool gf_sys_enable_remotery(Bool start, Bool is_shutdown);

static Bool gpac_disable_rti = GF_FALSE;
Expand Down

0 comments on commit 87efbf2

Please sign in to comment.