michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * JS Date class interface. michael@0: */ michael@0: michael@0: #ifndef jsdate_h michael@0: #define jsdate_h michael@0: michael@0: #include "jstypes.h" michael@0: michael@0: #include "js/RootingAPI.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: /* michael@0: * These functions provide a C interface to the date/time object michael@0: */ michael@0: michael@0: /* michael@0: * Construct a new Date Object from a time value given in milliseconds UTC michael@0: * since the epoch. michael@0: */ michael@0: extern JS_FRIEND_API(JSObject *) michael@0: js_NewDateObjectMsec(JSContext* cx, double msec_time); michael@0: michael@0: /* michael@0: * Construct a new Date Object from an exploded local time value. michael@0: * michael@0: * Assert that mon < 12 to help catch off-by-one user errors, which are common michael@0: * due to the 0-based month numbering copied into JS from Java (java.util.Date michael@0: * in 1995). michael@0: */ michael@0: extern JS_FRIEND_API(JSObject *) michael@0: js_NewDateObject(JSContext* cx, int year, int mon, int mday, michael@0: int hour, int min, int sec); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetYear(JSContext *cx, JSObject *obj); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetMonth(JSContext *cx, JSObject *obj); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetDate(JSContext *cx, JSObject *obj); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetHours(JSContext *cx, JSObject *obj); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetMinutes(JSContext *cx, JSObject *obj); michael@0: michael@0: extern JS_FRIEND_API(int) michael@0: js_DateGetSeconds(JSObject *obj); michael@0: michael@0: /* Date constructor native. Exposed only so the JIT can know its address. */ michael@0: bool michael@0: js_Date(JSContext *cx, unsigned argc, JS::Value *vp); michael@0: michael@0: #endif /* jsdate_h */