This is copy-paste from emscripten_get_now(), https://github.com/kripken/emscripten/blob/master/src/library.js#L8722 . It would be preferable not to have to maintain multiple implementations of this functionality separately.