indexOf

fun indexOf(epochMillis: Long): Long

Index of the bucket containing epochMillis, floored: the result n always satisfies keyOf(n) <= epochMillis < keyOf(n + 1).

Temporal.until truncates toward zero for date-based units, so non-aligned instants before the anchor land one bucket ahead — including differences within (-1, 0) units, which truncate to 0; the overshoot check restores floor semantics on the negative side. Non-negative truncation is already floor.