michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ 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: #ifndef mozilla_TimeStamp_windows_h michael@0: #define mozilla_TimeStamp_windows_h michael@0: michael@0: namespace mozilla { michael@0: michael@0: class TimeStamp; michael@0: michael@0: class TimeStampValue michael@0: { michael@0: friend struct IPC::ParamTraits; michael@0: friend class TimeStamp; michael@0: friend void StartupTimelineRecordExternal(int, uint64_t); michael@0: michael@0: // Both QPC and GTC are kept in [mt] units. michael@0: uint64_t mGTC; michael@0: uint64_t mQPC; michael@0: bool mHasQPC; michael@0: bool mIsNull; michael@0: michael@0: TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC); michael@0: michael@0: uint64_t CheckQPC(const TimeStampValue &aOther) const; michael@0: michael@0: struct _SomethingVeryRandomHere; michael@0: MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue) michael@0: : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {} michael@0: michael@0: michael@0: public: michael@0: uint64_t operator-(const TimeStampValue &aOther) const; michael@0: michael@0: TimeStampValue operator+(const int64_t aOther) const michael@0: { return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC); } michael@0: TimeStampValue operator-(const int64_t aOther) const michael@0: { return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC); } michael@0: TimeStampValue& operator+=(const int64_t aOther); michael@0: TimeStampValue& operator-=(const int64_t aOther); michael@0: michael@0: bool operator<(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) < 0; } michael@0: bool operator>(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) > 0; } michael@0: bool operator<=(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) <= 0; } michael@0: bool operator>=(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) >= 0; } michael@0: bool operator==(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) == 0; } michael@0: bool operator!=(const TimeStampValue &aOther) const michael@0: { return int64_t(*this - aOther) != 0; } michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif /* mozilla_TimeStamp_h */