i would think the above might be more efficient th...
# announcements
m
i would think the above might be more efficient that
60.seconds.inMinutes
just because there's no overhead of class creation. Thoughts?
o
Copy code
inline class TimeWrapper(val timeInMillis: Int) {
    inline val inMillis get() = timeInMillis
    inline val inSeconds get() = timeInMillis / 1000
    inline val inMinutes get() = timeInMillis / 60 / 1000
}

val Int.millis get() = TimeWrapper(timeInMillis = this)
val Int.seconds get() = TimeWrapper(timeInMillis = this * 1000)

fun main(args: Array<String>) {
    println("120 seconds in minutes = " +
            120.seconds.inMinutes)
}
Try it: https://pl.kotl.in/BkJldoSn7