diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-05-05 12:55:51 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-05-05 12:55:51 +0200 |
commit | e2f931b4cbcf5a4fc08cda89259e44e2e2bbcffa (patch) | |
tree | 425916b54028695cf0cb76cc969e8553af87fdaa /ui/src/main | |
parent | d6ad7d11d0dce92f927406379ced57af17b7bf6d (diff) |
ui: use .seconds instead of .toDuration
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/util/QuantityFormatter.kt | 4 |
1 files changed, 2 insertions, 2 deletions
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) |