js/src/jsdate.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jsdate.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/*
    1.11 + * JS Date class interface.
    1.12 + */
    1.13 +
    1.14 +#ifndef jsdate_h
    1.15 +#define jsdate_h
    1.16 +
    1.17 +#include "jstypes.h"
    1.18 +
    1.19 +#include "js/RootingAPI.h"
    1.20 +#include "js/TypeDecls.h"
    1.21 +
    1.22 +/*
    1.23 + * These functions provide a C interface to the date/time object
    1.24 + */
    1.25 +
    1.26 +/*
    1.27 + * Construct a new Date Object from a time value given in milliseconds UTC
    1.28 + * since the epoch.
    1.29 + */
    1.30 +extern JS_FRIEND_API(JSObject *)
    1.31 +js_NewDateObjectMsec(JSContext* cx, double msec_time);
    1.32 +
    1.33 +/*
    1.34 + * Construct a new Date Object from an exploded local time value.
    1.35 + *
    1.36 + * Assert that mon < 12 to help catch off-by-one user errors, which are common
    1.37 + * due to the 0-based month numbering copied into JS from Java (java.util.Date
    1.38 + * in 1995).
    1.39 + */
    1.40 +extern JS_FRIEND_API(JSObject *)
    1.41 +js_NewDateObject(JSContext* cx, int year, int mon, int mday,
    1.42 +                 int hour, int min, int sec);
    1.43 +
    1.44 +extern JS_FRIEND_API(int)
    1.45 +js_DateGetYear(JSContext *cx, JSObject *obj);
    1.46 +
    1.47 +extern JS_FRIEND_API(int)
    1.48 +js_DateGetMonth(JSContext *cx, JSObject *obj);
    1.49 +
    1.50 +extern JS_FRIEND_API(int)
    1.51 +js_DateGetDate(JSContext *cx, JSObject *obj);
    1.52 +
    1.53 +extern JS_FRIEND_API(int)
    1.54 +js_DateGetHours(JSContext *cx, JSObject *obj);
    1.55 +
    1.56 +extern JS_FRIEND_API(int)
    1.57 +js_DateGetMinutes(JSContext *cx, JSObject *obj);
    1.58 +
    1.59 +extern JS_FRIEND_API(int)
    1.60 +js_DateGetSeconds(JSObject *obj);
    1.61 +
    1.62 +/* Date constructor native. Exposed only so the JIT can know its address. */
    1.63 +bool
    1.64 +js_Date(JSContext *cx, unsigned argc, JS::Value *vp);
    1.65 +
    1.66 +#endif /* jsdate_h */

mercurial