diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-09-03 20:38:26 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-09-03 20:38:26 +0530 |
commit | f51a59bc72c2886cb2bb88b149a3353857e3eb44 (patch) | |
tree | fee6f86112580241f8328869c1e71dd58e238fa9 /packages/taler-wallet-core/src/util/time.ts | |
parent | bf9c2ae7f9c24168ddea2ef9387c5a624287d993 (diff) | |
download | wallet-core-f51a59bc72c2886cb2bb88b149a3353857e3eb44.tar.xz |
implement and test auto-refresh
Diffstat (limited to 'packages/taler-wallet-core/src/util/time.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/time.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/time.ts b/packages/taler-wallet-core/src/util/time.ts index 512d5e908..1f085107f 100644 --- a/packages/taler-wallet-core/src/util/time.ts +++ b/packages/taler-wallet-core/src/util/time.ts @@ -144,6 +144,13 @@ export function durationMax(d1: Duration, d2: Duration): Duration { return { d_ms: Math.max(d1.d_ms, d2.d_ms) }; } +export function durationMul(d: Duration, n: number): Duration { + if (d.d_ms === "forever") { + return { d_ms: "forever" }; + } + return { d_ms: Math.round( d.d_ms * n) }; +} + export function timestampCmp(t1: Timestamp, t2: Timestamp): number { if (t1.t_ms === "never") { if (t2.t_ms === "never") { |