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 aGTC
, uint64_t aQPC
, bool aHasQPC
);
28 uint64_t CheckQPC(const TimeStampValue
& aOther
) const;
30 struct _SomethingVeryRandomHere
;
31 MOZ_CONSTEXPR
TimeStampValue(_SomethingVeryRandomHere
* aNullValue
)
40 uint64_t operator-(const TimeStampValue
& aOther
) const;
42 TimeStampValue
operator+(const int64_t aOther
) const
44 return TimeStampValue(mGTC
+ aOther
, mQPC
+ aOther
, mHasQPC
);
46 TimeStampValue
operator-(const int64_t aOther
) const
48 return TimeStampValue(mGTC
- aOther
, mQPC
- aOther
, mHasQPC
);
50 TimeStampValue
& operator+=(const int64_t aOther
);
51 TimeStampValue
& operator-=(const int64_t aOther
);
53 bool operator<(const TimeStampValue
& aOther
) const
55 return int64_t(*this - aOther
) < 0;
57 bool operator>(const TimeStampValue
& aOther
) const
59 return int64_t(*this - aOther
) > 0;
61 bool operator<=(const TimeStampValue
& aOther
) const
63 return int64_t(*this - aOther
) <= 0;
65 bool operator>=(const TimeStampValue
& aOther
) const
67 return int64_t(*this - aOther
) >= 0;
69 bool operator==(const TimeStampValue
& aOther
) const
71 return int64_t(*this - aOther
) == 0;
73 bool operator!=(const TimeStampValue
& aOther
) const
75 return int64_t(*this - aOther
) != 0;
81 #endif /* mozilla_TimeStamp_h */