mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-09-11 08:25:40 +03:00
32 lines
876 B
JavaScript
32 lines
876 B
JavaScript
function h$clock_gettime_js(when, p_d, p_o) {
|
|
/* XXX: guess if we have to write 64 bit values:
|
|
|
|
alloca is often used and will give us 16 bytes
|
|
if timespec contains two 64 bit values
|
|
|
|
but we really should fix this by not having hsc2hs values
|
|
from the build system leak here
|
|
*/
|
|
var is64 = p_d.i3.length == 4 && p_o == 0;
|
|
var o = p_o >> 2,
|
|
t = Date.now ? Date.now() : new Date().getTime(),
|
|
tf = Math.floor(t / 1000),
|
|
tn = 1000000 * (t - (1000 * tf));
|
|
if(is64) {
|
|
p_d.i3[o] = tf|0;
|
|
p_d.i3[o+1] = 0;
|
|
p_d.i3[o+2] = tn|0;
|
|
p_d.i3[o+3] = 0;
|
|
} else {
|
|
p_d.i3[o] = tf|0;
|
|
p_d.i3[o+1] = tn|0;
|
|
}
|
|
return 0;
|
|
}
|
|
/* Hack! Supporting code for "clock" package
|
|
* "hspec" depends on clock.
|
|
*/
|
|
function h$hs_clock_darwin_gettime(when, p_d, p_o) {
|
|
h$clock_gettime_js(when, p_d, p_o);
|
|
}
|