aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/TimeMark.kt
blob: 83285550df5c18106f1cecb1a7f2712a915968cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package at.hannibal2.skyhanni.utils

import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds


data class TimeMark(val long: Long) {

    fun hasNeverHappened() = long == 0L
    fun passedTime() = if (long == 0L) Duration.Companion.INFINITE else (System.currentTimeMillis() - long).milliseconds

    companion object {
        fun never() = TimeMark(0)
        fun now() = TimeMark(System.currentTimeMillis())
    }
}