format-common: don't use hard-coded currentTimeMillis in TOTP logic

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-05-30 12:36:25 +05:30
parent 0de22d7f60
commit 5f83d6f2ff
No known key found for this signature in database
GPG Key ID: 366D7BBAD1031E80

View File

@ -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())