Add a less memory intensive timeAgo calculation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user