Skip to content

Commit 5af98ca

Browse files
authored
Remove non-standard Date.__date_clock method (bellard#88)
1 parent 8ba4f4b commit 5af98ca

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

quickjs.c

-14
Original file line numberDiff line numberDiff line change
@@ -39764,17 +39764,6 @@ static const JSCFunctionListEntry js_math_obj[] = {
3976439764

3976539765
/* Date */
3976639766

39767-
/* OS dependent: return the UTC time in microseconds since 1970. */
39768-
static JSValue js___date_clock(JSContext *ctx, JSValueConst this_val,
39769-
int argc, JSValueConst *argv)
39770-
{
39771-
int64_t d;
39772-
struct timeval tv;
39773-
gettimeofday(&tv, NULL);
39774-
d = (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
39775-
return JS_NewInt64(ctx, d);
39776-
}
39777-
3977839767
/* OS dependent. d = argv[0] is in ms from 1970. Return the difference
3977939768
between UTC time and local time 'd' in minutes */
3978039769
static int getTimezoneOffset(int64_t time) {
@@ -45555,9 +45544,6 @@ static const JSCFunctionListEntry js_global_funcs[] = {
4555545544
JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ),
4555645545
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ),
4555745546
JS_PROP_UNDEFINED_DEF("undefined", 0 ),
45558-
45559-
/* for the 'Date' implementation */
45560-
JS_CFUNC_DEF("__date_clock", 0, js___date_clock ),
4556145547
};
4556245548

4556345549
/* Date */

tests/microbench.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,7 @@ var clocks_per_sec = 1000000;
9797
var max_iterations = 100;
9898
var clock_threshold = 2000; /* favoring short measuring spans */
9999
var min_n_argument = 1;
100-
var get_clock;
101-
102-
if (typeof globalThis.__date_clock != "function") {
103-
console.log("using fallback millisecond clock");
104-
clocks_per_sec = 1000;
105-
max_iterations = 10;
106-
clock_threshold = 100;
107-
get_clock = Date.now;
108-
} else {
109-
get_clock = globalThis.__date_clock;
110-
}
100+
var get_clock = Date.now;
111101

112102
function log_one(text, n, ti) {
113103
var ref;

0 commit comments

Comments
 (0)