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
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.
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) {}
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 */