diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-03-13 19:04:16 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-03-13 19:04:16 +0530 |
commit | 1744b1a80063397105081a4d5aeec76936781345 (patch) | |
tree | 53399350dba33fd6e7c916b3c177e36ff7e283f9 /src/util | |
parent | 51eef5419a37187f437115316a00ceec91e4addb (diff) | |
download | wallet-core-1744b1a80063397105081a4d5aeec76936781345.tar.xz |
signature verification for recoup
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/time.ts | 10 |
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; |