summaryrefslogtreecommitdiff
path: root/src/util/time.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/time.ts')
-rw-r--r--src/util/time.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/time.ts b/src/util/time.ts
index 54d22bf81..88297f9a9 100644
--- a/src/util/time.ts
+++ b/src/util/time.ts
@@ -132,6 +132,16 @@ export function timestampDifference(t1: Timestamp, t2: Timestamp): Duration {
return { d_ms: Math.abs(t1.t_ms - t2.t_ms) };
}
+export function timestampIsBetween(t: Timestamp, start: Timestamp, end: Timestamp) {
+ if (timestampCmp(t, start) < 0) {
+ return false;
+ }
+ if (timestampCmp(t, end) > 0) {
+ return false;
+ }
+ return true;
+}
+
export const codecForTimestamp: Codec<Timestamp> = {
decode(x: any, c?: Context): Timestamp {
const t_ms = x.t_ms;