michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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: /* Representation for dates. */ michael@0: michael@0: #ifndef mozilla_dom_Date_h michael@0: #define mozilla_dom_Date_h michael@0: michael@0: #include "js/TypeDecls.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class Date michael@0: { michael@0: public: michael@0: // Not inlining much here to avoid the includes we'd need. michael@0: Date(); michael@0: Date(double aMilliseconds) michael@0: : mMsecSinceEpoch(aMilliseconds) michael@0: {} michael@0: michael@0: bool IsUndefined() const; michael@0: double TimeStamp() const michael@0: { michael@0: return mMsecSinceEpoch; michael@0: } michael@0: void SetTimeStamp(double aMilliseconds) michael@0: { michael@0: mMsecSinceEpoch = aMilliseconds; michael@0: } michael@0: // Can return false if CheckedUnwrap fails. This will NOT throw; michael@0: // callers should do it as needed. michael@0: bool SetTimeStamp(JSContext* aCx, JSObject* aObject); michael@0: michael@0: bool ToDateObject(JSContext* aCx, JS::MutableHandle aRval) const; michael@0: michael@0: private: michael@0: double mMsecSinceEpoch; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_Date_h