|
|
@ -8,6 +8,7 @@ DUK_INTERNAL duk_double_t duk_time_get_ecmascript_time(duk_hthread *thr) { |
|
|
|
/* Ecmascript time, with millisecond fractions. Exposed via
|
|
|
|
* duk_get_now() for example. |
|
|
|
*/ |
|
|
|
DUK_UNREF(thr); |
|
|
|
return (duk_double_t) DUK_USE_DATE_GET_NOW(thr); |
|
|
|
} |
|
|
|
|
|
|
@ -15,10 +16,12 @@ DUK_INTERNAL duk_double_t duk_time_get_ecmascript_time_nofrac(duk_hthread *thr) |
|
|
|
/* Ecmascript time without millisecond fractions. Exposed via
|
|
|
|
* the Date built-in which doesn't allow fractions. |
|
|
|
*/ |
|
|
|
DUK_UNREF(thr); |
|
|
|
return (duk_double_t) DUK_FLOOR(DUK_USE_DATE_GET_NOW(thr)); |
|
|
|
} |
|
|
|
|
|
|
|
DUK_INTERNAL duk_double_t duk_time_get_monotonic_time(duk_hthread *thr) { |
|
|
|
DUK_UNREF(thr); |
|
|
|
#if defined(DUK_USE_GET_MONOTONIC_TIME) |
|
|
|
return (duk_double_t) DUK_USE_GET_MONOTONIC_TIME(thr); |
|
|
|
#else |
|
|
@ -28,6 +31,7 @@ DUK_INTERNAL duk_double_t duk_time_get_monotonic_time(duk_hthread *thr) { |
|
|
|
|
|
|
|
DUK_EXTERNAL duk_double_t duk_get_now(duk_hthread *thr) { |
|
|
|
DUK_ASSERT_API_ENTRY(thr); |
|
|
|
DUK_UNREF(thr); |
|
|
|
|
|
|
|
/* This API intentionally allows millisecond fractions. */ |
|
|
|
return duk_time_get_ecmascript_time(thr); |
|
|
@ -36,6 +40,7 @@ DUK_EXTERNAL duk_double_t duk_get_now(duk_hthread *thr) { |
|
|
|
#if 0 /* XXX: worth exposing? */
|
|
|
|
DUK_EXTERNAL duk_double_t duk_get_monotonic_time(duk_hthread *thr) { |
|
|
|
DUK_ASSERT_API_ENTRY(thr); |
|
|
|
DUK_UNREF(thr); |
|
|
|
|
|
|
|
return duk_time_get_monotonic_time(thr); |
|
|
|
} |
|
|
|