diff --git a/app/src/main/kotlin/li/songe/gkd/util/TimeExt.kt b/app/src/main/kotlin/li/songe/gkd/util/TimeExt.kt index 0532482..11263c9 100644 --- a/app/src/main/kotlin/li/songe/gkd/util/TimeExt.kt +++ b/app/src/main/kotlin/li/songe/gkd/util/TimeExt.kt @@ -3,6 +3,7 @@ package li.songe.gkd.util import java.text.SimpleDateFormat import java.util.Locale import java.util.concurrent.TimeUnit +import kotlin.collections.hashMapOf fun formatTimeAgo(timestamp: Long): String { val currentTime = System.currentTimeMillis() @@ -25,7 +26,7 @@ fun formatTimeAgo(timestamp: Long): String { } } -private val formatDateMap = mutableMapOf() +private val formatDateMap by lazy { hashMapOf() } fun Long.format(formatStr: String): String { var df = formatDateMap[formatStr]