From e2f931b4cbcf5a4fc08cda89259e44e2e2bbcffa Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 5 May 2023 12:55:51 +0200 Subject: ui: use .seconds instead of .toDuration Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/src/main/java/com/wireguard') diff --git a/ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt b/ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt index 5a533550..bc059e1b 100644 --- a/ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt +++ b/ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt @@ -14,8 +14,8 @@ import android.os.Build import com.wireguard.android.Application import com.wireguard.android.R import java.util.Locale +import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit -import kotlin.time.toDuration object QuantityFormatter { fun formatBytes(bytes: Long): String { @@ -33,7 +33,7 @@ object QuantityFormatter { var span = (System.currentTimeMillis() - epochMillis) / 1000 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) - return Application.get().applicationContext.getString(R.string.latest_handshake_ago, span.toDuration(DurationUnit.SECONDS).toString()) + return Application.get().applicationContext.getString(R.string.latest_handshake_ago, span.seconds.toString()) if (span <= 0L) return RelativeDateTimeFormatter.getInstance().format(RelativeDateTimeFormatter.Direction.PLAIN, RelativeDateTimeFormatter.AbsoluteUnit.NOW) -- cgit v1.2.3