Remove non-standard Date.__date_clock method (#88)

This commit is contained in:
Ben Noordhuis 2023-11-18 19:15:05 +01:00 committed by GitHub
parent 8ba4f4b824
commit 5af98ca858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 25 deletions

View file

@ -39764,17 +39764,6 @@ static const JSCFunctionListEntry js_math_obj[] = {
/* Date */
/* OS dependent: return the UTC time in microseconds since 1970. */
static JSValue js___date_clock(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
int64_t d;
struct timeval tv;
gettimeofday(&tv, NULL);
d = (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
return JS_NewInt64(ctx, d);
}
/* OS dependent. d = argv[0] is in ms from 1970. Return the difference
between UTC time and local time 'd' in minutes */
static int getTimezoneOffset(int64_t time) {
@ -45555,9 +45544,6 @@ static const JSCFunctionListEntry js_global_funcs[] = {
JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ),
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ),
JS_PROP_UNDEFINED_DEF("undefined", 0 ),
/* for the 'Date' implementation */
JS_CFUNC_DEF("__date_clock", 0, js___date_clock ),
};
/* Date */

View file

@ -97,17 +97,7 @@ var clocks_per_sec = 1000000;
var max_iterations = 100;
var clock_threshold = 2000; /* favoring short measuring spans */
var min_n_argument = 1;
var get_clock;
if (typeof globalThis.__date_clock != "function") {
console.log("using fallback millisecond clock");
clocks_per_sec = 1000;
max_iterations = 10;
clock_threshold = 100;
get_clock = Date.now;
} else {
get_clock = globalThis.__date_clock;
}
var get_clock = Date.now;
function log_one(text, n, ti) {
var ref;