1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/TimeStamp_windows.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_TimeStamp_windows_h 1.11 +#define mozilla_TimeStamp_windows_h 1.12 + 1.13 +namespace mozilla { 1.14 + 1.15 +class TimeStamp; 1.16 + 1.17 +class TimeStampValue 1.18 +{ 1.19 + friend struct IPC::ParamTraits<mozilla::TimeStampValue>; 1.20 + friend class TimeStamp; 1.21 + friend void StartupTimelineRecordExternal(int, uint64_t); 1.22 + 1.23 + // Both QPC and GTC are kept in [mt] units. 1.24 + uint64_t mGTC; 1.25 + uint64_t mQPC; 1.26 + bool mHasQPC; 1.27 + bool mIsNull; 1.28 + 1.29 + TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC); 1.30 + 1.31 + uint64_t CheckQPC(const TimeStampValue &aOther) const; 1.32 + 1.33 + struct _SomethingVeryRandomHere; 1.34 + MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue) 1.35 + : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {} 1.36 + 1.37 + 1.38 +public: 1.39 + uint64_t operator-(const TimeStampValue &aOther) const; 1.40 + 1.41 + TimeStampValue operator+(const int64_t aOther) const 1.42 + { return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC); } 1.43 + TimeStampValue operator-(const int64_t aOther) const 1.44 + { return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC); } 1.45 + TimeStampValue& operator+=(const int64_t aOther); 1.46 + TimeStampValue& operator-=(const int64_t aOther); 1.47 + 1.48 + bool operator<(const TimeStampValue &aOther) const 1.49 + { return int64_t(*this - aOther) < 0; } 1.50 + bool operator>(const TimeStampValue &aOther) const 1.51 + { return int64_t(*this - aOther) > 0; } 1.52 + bool operator<=(const TimeStampValue &aOther) const 1.53 + { return int64_t(*this - aOther) <= 0; } 1.54 + bool operator>=(const TimeStampValue &aOther) const 1.55 + { return int64_t(*this - aOther) >= 0; } 1.56 + bool operator==(const TimeStampValue &aOther) const 1.57 + { return int64_t(*this - aOther) == 0; } 1.58 + bool operator!=(const TimeStampValue &aOther) const 1.59 + { return int64_t(*this - aOther) != 0; } 1.60 +}; 1.61 + 1.62 +} 1.63 + 1.64 +#endif /* mozilla_TimeStamp_h */