mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-29 14:36:30 +03:00
added os.now()
This commit is contained in:
30
quickjs.c
30
quickjs.c
@@ -42791,30 +42791,6 @@ static const JSCFunctionListEntry js_math_obj[] = {
|
||||
|
||||
/* Date */
|
||||
|
||||
#if 0
|
||||
/* OS dependent: return the UTC time in ms since 1970. */
|
||||
static JSValue js___date_now(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
int64_t d;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
d = (int64_t)tv.tv_sec * 1000 + (tv.tv_usec / 1000);
|
||||
return JS_NewInt64(ctx, d);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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) {
|
||||
@@ -48899,12 +48875,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 ),
|
||||
//JS_CFUNC_DEF("__date_now", 0, js___date_now ),
|
||||
//JS_CFUNC_DEF("__date_getTimezoneOffset", 1, js___date_getTimezoneOffset ),
|
||||
//JS_CFUNC_DEF("__date_create", 3, js___date_create ),
|
||||
};
|
||||
|
||||
/* Date */
|
||||
|
Reference in New Issue
Block a user