mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1321885 - Add Max() and Min() methods to TimeDuration. r=froydnj
MozReview-Commit-ID: 4WvRa3ZSrmP --HG-- extra : rebase_source : d7433ab7cdb949194e494568f0bf94b91639e27e extra : source : bac442a609767fbb21b266dbd719d6eb968fbf3d
This commit is contained in:
parent
3228e94e88
commit
71a6962e97
@ -8,6 +8,7 @@
|
||||
#define mozilla_TimeStamp_h
|
||||
|
||||
#include <stdint.h>
|
||||
#include <algorithm> // for std::min, std::max
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
@ -175,6 +176,17 @@ public:
|
||||
return FromTicks(ticks);
|
||||
}
|
||||
|
||||
static BaseTimeDuration Max(const BaseTimeDuration& aA,
|
||||
const BaseTimeDuration& aB)
|
||||
{
|
||||
return FromTicks(std::max(aA.mValue, aB.mValue));
|
||||
}
|
||||
static BaseTimeDuration Min(const BaseTimeDuration& aA,
|
||||
const BaseTimeDuration& aB)
|
||||
{
|
||||
return FromTicks(std::min(aA.mValue, aB.mValue));
|
||||
}
|
||||
|
||||
private:
|
||||
// Block double multiplier (slower, imprecise if long duration) - Bug 853398.
|
||||
// If required, use MultDouble explicitly and with care.
|
||||
|
Loading…
Reference in New Issue
Block a user