|
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/. */ |
|
6 |
|
7 #ifndef mozilla_TimeStamp_windows_h |
|
8 #define mozilla_TimeStamp_windows_h |
|
9 |
|
10 namespace mozilla { |
|
11 |
|
12 class TimeStamp; |
|
13 |
|
14 class TimeStampValue |
|
15 { |
|
16 friend struct IPC::ParamTraits<mozilla::TimeStampValue>; |
|
17 friend class TimeStamp; |
|
18 friend void StartupTimelineRecordExternal(int, uint64_t); |
|
19 |
|
20 // Both QPC and GTC are kept in [mt] units. |
|
21 uint64_t mGTC; |
|
22 uint64_t mQPC; |
|
23 bool mHasQPC; |
|
24 bool mIsNull; |
|
25 |
|
26 TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC); |
|
27 |
|
28 uint64_t CheckQPC(const TimeStampValue &aOther) const; |
|
29 |
|
30 struct _SomethingVeryRandomHere; |
|
31 MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue) |
|
32 : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {} |
|
33 |
|
34 |
|
35 public: |
|
36 uint64_t operator-(const TimeStampValue &aOther) const; |
|
37 |
|
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); |
|
44 |
|
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; } |
|
57 }; |
|
58 |
|
59 } |
|
60 |
|
61 #endif /* mozilla_TimeStamp_h */ |