From f8d12f7b0d4af1b1769b89e80c87f9c169678564 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 18 Mar 2022 15:32:41 +0100 Subject: wallet: t_s/d_us migration --- packages/taler-wallet-core/src/wallet.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'packages/taler-wallet-core/src/wallet.ts') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 329417562..bbff465a8 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -64,9 +64,7 @@ import { durationMin, ExchangeListItem, ExchangesListRespose, - getDurationRemaining, GetExchangeTosResult, - isTimestampExpired, j2s, KnownBankAccounts, Logger, @@ -76,11 +74,12 @@ import { PaytoUri, RefreshReason, TalerErrorCode, - Timestamp, - timestampMin, + AbsoluteTime, URL, WalletNotification, + Duration, } from "@gnu-taler/taler-util"; +import { timeStamp } from "console"; import { DenomInfo, ExchangeOperations, @@ -292,7 +291,7 @@ export async function runPending( ): Promise { const pendingOpsResponse = await getPendingOperations(ws); for (const p of pendingOpsResponse.pendingOperations) { - if (!forceNow && !isTimestampExpired(p.timestampDue)) { + if (!forceNow && !AbsoluteTime.isExpired(p.timestampDue)) { continue; } try { @@ -340,10 +339,10 @@ async function runTaskLoop( logger.trace(`pending operations: ${j2s(pending)}`); let numGivingLiveness = 0; let numDue = 0; - let minDue: Timestamp = { t_ms: "never" }; + let minDue: AbsoluteTime = AbsoluteTime.never(); for (const p of pending.pendingOperations) { - minDue = timestampMin(minDue, p.timestampDue); - if (isTimestampExpired(p.timestampDue)) { + minDue = AbsoluteTime.min(minDue, p.timestampDue); + if (AbsoluteTime.isExpired(p.timestampDue)) { numDue++; } if (p.givesLifeness) { @@ -377,7 +376,7 @@ async function runTaskLoop( durationFromSpec({ seconds: 5, }), - getDurationRemaining(minDue), + Duration.getRemaining(minDue), ); logger.trace(`waiting for at most ${dt.d_ms} ms`); const timeout = ws.timerGroup.resolveAfter(dt); @@ -394,7 +393,7 @@ async function runTaskLoop( `running ${pending.pendingOperations.length} pending operations`, ); for (const p of pending.pendingOperations) { - if (!isTimestampExpired(p.timestampDue)) { + if (!AbsoluteTime.isExpired(p.timestampDue)) { continue; } try { -- cgit v1.2.3