Add a less memory intensive timeAgo calculation

This commit is contained in:
Vitor Pamplona
2023-12-19 15:46:36 -05:00
parent 2371e0678a
commit 065dba2431
3 changed files with 45 additions and 40 deletions
@@ -9,6 +9,8 @@ object TimeUtils {
const val eightHours = 8 * oneHour
const val oneDay = 24 * oneHour
const val oneWeek = 7 * oneDay
const val oneMonth = 30 * oneDay
const val oneYear = 365 * oneDay
fun now() = System.currentTimeMillis() / 1000
fun oneMinuteAgo() = now() - oneMinute
@@ -19,4 +21,4 @@ object TimeUtils {
fun eightHoursAgo() = now() - eightHours
fun oneWeekAgo() = now() - oneWeek
fun randomWithinAWeek() = System.currentTimeMillis() / 1000 - CryptoUtils.randomInt(oneWeek)
}
}