Есть ли проблема с попыткой передать константу или переменную в метод rem () в kotlin?
object TimeCalc {
private const val SECONDS: Int = 1000
private const val MINUTES: Int = SECONDS * 60
private const val HOURS: Int = MINUTES * 60
private const val DAYS: Int = HOURS * 24
fun timeDiff(sTime: Long, eTime: Long){
Log.i("Test", "sec $SECONDS: min $MINUTES : hrs $HOURS : days $DAYS")
var startTime = sTime
var endTime = eTime
var mDiff: Int
var mHours: Int
var mMinutes: Int
var mSeconds:Int
var mMilliS: Int
Log.i("Test", "$startTime - $endTime")
mDiff = (endTime - startTime).toInt()
Log.i("Test", "Diff = $mDiff")
**mHours = mDiff.rem(DAYS)**
Log.i("Test", "Hours = $mHours")
Log.i("Test", "${mHours}")
}
}
Результат
I/Test: sec 1000: min 60000 : hrs 3600000 : days 86400000
I/Test: 1545062123189 - 1545062217296
I/Test: Diff = 94107
I/Test: Hours = 94107
I/Test: 94107