1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 05:46:58 +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:
Botond Ballo
2023-10-01 19:37:49 +02:00
committed by roytam1
parent e0e1542913
commit c78ecee3f2
+12
View File
@@ -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.