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