From 5f83d6f2ffaa3bfc311bb5bd888790797c122f2b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 30 May 2021 12:36:25 +0530 Subject: format-common: don't use hard-coded currentTimeMillis in TOTP logic Signed-off-by: Harsh Shandilya --- .../src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'format-common') diff --git a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt index b2633c71..34288f50 100644 --- a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt +++ b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt @@ -87,7 +87,7 @@ constructor( if (totpSecret != null) { scope.launch { updateTotp(clock.millis()) - val remainingTime = totpPeriod - (System.currentTimeMillis() % totpPeriod) + val remainingTime = totpPeriod - (clock.millis() % totpPeriod) delay(Duration.seconds(remainingTime)) repeat(Int.MAX_VALUE) { updateTotp(clock.millis()) -- cgit v1.2.3