compare To
Compares this
time value with the other time value. Returns zero if this value is equal to the other, a negative number if this value occurs earlier in the course of a typical day than the other, and a positive number if this value occurs later in the course of a typical day than the other.
Note that, on days when there is a time overlap (for example, due to the daylight saving time transitions in autumn), a "lesser" wall-clock reading can, in fact, happen later than the "greater" one.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() {
//sampleStart
// Comparing LocalTime values
check(LocalTime(hour = 8, minute = 30) < LocalTime(hour = 17, minute = 10))
check(LocalTime(hour = 8, minute = 30) < LocalTime(hour = 8, minute = 31))
check(LocalTime(hour = 8, minute = 30) < LocalTime(hour = 8, minute = 30, second = 1))
check(LocalTime(hour = 8, minute = 30) < LocalTime(hour = 8, minute = 30, second = 0, nanosecond = 1))
//sampleEnd
}