Backed out changeset 4c2bc5ae8f95 (bug 945562) for device image bustage.
[gecko.git] / xpcom / ds / TimeStamp_windows.h
blobd4e34222f062d28d3bb7ebb0b9702cc0affc07ed
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 #ifndef mozilla_TimeStamp_windows_h
8 #define mozilla_TimeStamp_windows_h
10 namespace mozilla {
12 class TimeStamp;
14 class TimeStampValue
16 friend struct IPC::ParamTraits<mozilla::TimeStampValue>;
17 friend class TimeStamp;
18 friend void StartupTimelineRecordExternal(int, uint64_t);
20 // Both QPC and GTC are kept in [mt] units.
21 uint64_t mGTC;
22 uint64_t mQPC;
23 bool mHasQPC;
24 bool mIsNull;
26 TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC);
28 uint64_t CheckQPC(const TimeStampValue &aOther) const;
30 struct _SomethingVeryRandomHere;
31 MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue)
32 : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {}
35 public:
36 uint64_t operator-(const TimeStampValue &aOther) const;
38 TimeStampValue operator+(const int64_t aOther) const
39 { return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC); }
40 TimeStampValue operator-(const int64_t aOther) const
41 { return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC); }
42 TimeStampValue& operator+=(const int64_t aOther);
43 TimeStampValue& operator-=(const int64_t aOther);
45 bool operator<(const TimeStampValue &aOther) const
46 { return int64_t(*this - aOther) < 0; }
47 bool operator>(const TimeStampValue &aOther) const
48 { return int64_t(*this - aOther) > 0; }
49 bool operator<=(const TimeStampValue &aOther) const
50 { return int64_t(*this - aOther) <= 0; }
51 bool operator>=(const TimeStampValue &aOther) const
52 { return int64_t(*this - aOther) >= 0; }
53 bool operator==(const TimeStampValue &aOther) const
54 { return int64_t(*this - aOther) == 0; }
55 bool operator!=(const TimeStampValue &aOther) const
56 { return int64_t(*this - aOther) != 0; }
61 #endif /* mozilla_TimeStamp_h */