mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 05:38:39 +00:00
Issue #2323 - Part 1: Add Min()/Max() methods to TimeDuration.
Just some helper functions to make time comparisons in the correct data format easier. See BZ 1321885
This commit is contained in:
@@ -7,6 +7,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"
|
||||
@@ -173,6 +174,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.
|
||||
|
||||
Reference in New Issue
Block a user