Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /*
8 * JS Date class interface.
9 */
11 #ifndef jsdate_h
12 #define jsdate_h
14 #include "jstypes.h"
16 #include "js/RootingAPI.h"
17 #include "js/TypeDecls.h"
19 /*
20 * These functions provide a C interface to the date/time object
21 */
23 /*
24 * Construct a new Date Object from a time value given in milliseconds UTC
25 * since the epoch.
26 */
27 extern JS_FRIEND_API(JSObject *)
28 js_NewDateObjectMsec(JSContext* cx, double msec_time);
30 /*
31 * Construct a new Date Object from an exploded local time value.
32 *
33 * Assert that mon < 12 to help catch off-by-one user errors, which are common
34 * due to the 0-based month numbering copied into JS from Java (java.util.Date
35 * in 1995).
36 */
37 extern JS_FRIEND_API(JSObject *)
38 js_NewDateObject(JSContext* cx, int year, int mon, int mday,
39 int hour, int min, int sec);
41 extern JS_FRIEND_API(int)
42 js_DateGetYear(JSContext *cx, JSObject *obj);
44 extern JS_FRIEND_API(int)
45 js_DateGetMonth(JSContext *cx, JSObject *obj);
47 extern JS_FRIEND_API(int)
48 js_DateGetDate(JSContext *cx, JSObject *obj);
50 extern JS_FRIEND_API(int)
51 js_DateGetHours(JSContext *cx, JSObject *obj);
53 extern JS_FRIEND_API(int)
54 js_DateGetMinutes(JSContext *cx, JSObject *obj);
56 extern JS_FRIEND_API(int)
57 js_DateGetSeconds(JSObject *obj);
59 /* Date constructor native. Exposed only so the JIT can know its address. */
60 bool
61 js_Date(JSContext *cx, unsigned argc, JS::Value *vp);
63 #endif /* jsdate_h */