update defaults in KronTime

This commit is contained in:
InsanusMokrassar 2019-05-23 20:06:29 +08:00
parent 204bbe1f35
commit f3c4747053

View File

@ -68,18 +68,18 @@ internal fun KronTimes(
hoursParts ?.flatMap { hours -> hoursParts ?.flatMap { hours ->
weekDaysParts ?.map { weekDay -> weekDaysParts ?.map { weekDay ->
KronTime(millis, seconds, minutes, hours, weekDay) KronTime(millis, seconds, minutes, hours, weekDay)
} ?: listOf(KronTime(millis, seconds, minutes, hours, null)) } ?: listOf(KronTime(millis, seconds, minutes, hours))
} ?: listOf(KronTime(millis, seconds, minutes, null, null)) } ?: listOf(KronTime(millis, seconds, minutes))
} ?: listOf(KronTime(millis, seconds, null, null, null)) } ?: listOf(KronTime(millis, seconds))
} ?: listOf(KronTime(millis, null, null, null, null)) } ?: listOf(KronTime(milliseconds = millis))
} ?: listOf(KronTime(null, null, null, null, null)) } ?: listOf(KronTime())
} }
internal fun KronTime( internal fun KronTime(
milliseconds: Milliseconds fullMillis: Milliseconds
): KronTime { ): KronTime {
val millis = (milliseconds % millisCount).toShort() val millis = (fullMillis % millisCount).toShort()
var currentDivided: Double = floor(milliseconds.toDouble() / millisCount) var currentDivided: Double = floor(fullMillis.toDouble() / millisCount)
val seconds: Byte = (currentDivided % secondsCount).toByte() val seconds: Byte = (currentDivided % secondsCount).toByte()
currentDivided = floor(currentDivided / secondsCount) currentDivided = floor(currentDivided / secondsCount)
@ -102,9 +102,9 @@ internal fun KronTime(
} }
internal data class KronTime( internal data class KronTime(
val milliseconds: Milliseconds?, val milliseconds: Milliseconds? = null,
val seconds: Seconds?, val seconds: Seconds? = null,
val minutes: Minutes?, val minutes: Minutes? = null,
val hours: Hours?, val hours: Hours? = null,
val weekDays: WeekDays? val weekDays: WeekDays? = null
) )