@@ -56,8 +56,8 @@ import kotlin.time.*
5656 * ```
5757 *
5858 * For values very far in the past or the future, this conversion may fail.
59- * The specific range of values that can be converted to [LocalDateTime] is platform-specific , but at least
60- * [DISTANT_PAST], [DISTANT_FUTURE], and all values between them can be converted to [LocalDateTime] .
59+ * The specific range of values that can be converted to [LocalDateTime] is unspecified , but at least
60+ * [DISTANT_PAST], [DISTANT_FUTURE], and all values between them are included in that range .
6161 *
6262 * #### Date or time separately
6363 *
@@ -225,7 +225,8 @@ public expect class Instant : Comparable<Instant> {
225225 *
226226 * Any fractional part of a millisecond is rounded toward zero to the whole number of milliseconds.
227227 *
228- * If the result does not fit in [Long], returns [Long.MAX_VALUE] for a positive result or [Long.MIN_VALUE] for a negative result.
228+ * If the result does not fit in [Long],
229+ * returns [Long.MAX_VALUE] for a positive result or [Long.MIN_VALUE] for a negative result.
229230 *
230231 * @see fromEpochMilliseconds
231232 * @sample kotlinx.datetime.test.samples.InstantSamples.toEpochMilliseconds
@@ -238,7 +239,7 @@ public expect class Instant : Comparable<Instant> {
238239 * If the [duration] is positive, the returned instant is later than this instant.
239240 * If the [duration] is negative, the returned instant is earlier than this instant.
240241 *
241- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
242+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
242243 *
243244 * **Pitfall**: [Duration.Companion.days] are multiples of 24 hours and are not calendar-based.
244245 * Consider using the [plus] overload that accepts a multiple of a [DateTimeUnit] instead for calendar-based
@@ -255,7 +256,7 @@ public expect class Instant : Comparable<Instant> {
255256 * If the [duration] is positive, the returned instant is earlier than this instant.
256257 * If the [duration] is negative, the returned instant is later than this instant.
257258 *
258- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
259+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
259260 *
260261 * **Pitfall**: [Duration.Companion.days] are multiples of 24 hours and are not calendar-based.
261262 * Consider using the [minus] overload that accepts a multiple of a [DateTimeUnit] instead for calendar-based
@@ -319,8 +320,7 @@ public expect class Instant : Comparable<Instant> {
319320 /* *
320321 * Returns an [Instant] that is [epochMilliseconds] number of milliseconds from the epoch instant `1970-01-01T00:00:00Z`.
321322 *
322- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
323- * In any case, it is guaranteed that instants between [DISTANT_PAST] and [DISTANT_FUTURE] can be represented.
323+ * Every value of [epochMilliseconds] is guaranteed to be representable as an [Instant].
324324 *
325325 * Note that [Instant] also supports nanosecond precision via [fromEpochSeconds].
326326 *
@@ -333,7 +333,7 @@ public expect class Instant : Comparable<Instant> {
333333 * Returns an [Instant] that is the [epochSeconds] number of seconds from the epoch instant `1970-01-01T00:00:00Z`
334334 * and the [nanosecondAdjustment] number of nanoseconds from the whole second.
335335 *
336- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
336+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
337337 * In any case, it is guaranteed that instants between [DISTANT_PAST] and [DISTANT_FUTURE] can be represented.
338338 *
339339 * [fromEpochMilliseconds] is a similar function for when input data only has millisecond precision.
@@ -348,7 +348,7 @@ public expect class Instant : Comparable<Instant> {
348348 * Returns an [Instant] that is the [epochSeconds] number of seconds from the epoch instant `1970-01-01T00:00:00Z`
349349 * and the [nanosecondAdjustment] number of nanoseconds from the whole second.
350350 *
351- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
351+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
352352 * In any case, it is guaranteed that instants between [DISTANT_PAST] and [DISTANT_FUTURE] can be represented.
353353 *
354354 * [fromEpochMilliseconds] is a similar function for when input data only has millisecond precision.
@@ -389,7 +389,7 @@ public expect class Instant : Comparable<Instant> {
389389 * An instant value that is far in the past.
390390 *
391391 * All instants in the range `DISTANT_PAST..DISTANT_FUTURE` can be [converted][Instant.toLocalDateTime] to
392- * [LocalDateTime] without exceptions in every time zone on all supported platforms .
392+ * [LocalDateTime] without exceptions in every time zone.
393393 *
394394 * [isDistantPast] returns true for this value and all earlier ones.
395395 */
@@ -399,7 +399,7 @@ public expect class Instant : Comparable<Instant> {
399399 * An instant value that is far in the future.
400400 *
401401 * All instants in the range `DISTANT_PAST..DISTANT_FUTURE` can be [converted][Instant.toLocalDateTime] to
402- * [LocalDateTime] without exceptions in every time zone on all supported platforms .
402+ * [LocalDateTime] without exceptions in every time zone.
403403 *
404404 * [isDistantFuture] returns true for this value and all later ones.
405405 */
@@ -467,7 +467,7 @@ public expect fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Inst
467467public fun Instant.minus (period : DateTimePeriod , timeZone : TimeZone ): Instant =
468468 /* An overflow can happen for any component, but we are only worried about nanoseconds, as having an overflow in
469469 any other component means that `plus` will throw due to the minimum value of the numeric type overflowing the
470- platform-specific limits. */
470+ `Instant` limits. */
471471 if (period.totalNanoseconds != Long .MIN_VALUE ) {
472472 val negatedPeriod = with (period) { buildDateTimePeriod(- totalMonths, - days, - totalNanoseconds) }
473473 plus(negatedPeriod, timeZone)
@@ -487,7 +487,6 @@ public fun Instant.minus(period: DateTimePeriod, timeZone: TimeZone): Instant =
487487 * - Exactly zero if this instant is equal to the other.
488488 *
489489 * @throws DateTimeArithmeticException if `this` or [other] instant is too large to fit in [LocalDateTime].
490- * Or (only on the JVM) if the number of months between the two dates exceeds an Int.
491490 * @sample kotlinx.datetime.test.samples.InstantSamples.periodUntil
492491 */
493492public expect fun Instant.periodUntil (other : Instant , timeZone : TimeZone ): DateTimePeriod
@@ -526,7 +525,7 @@ public fun Instant.until(other: Instant, unit: DateTimeUnit.TimeBased): Long =
526525 NANOS_PER_ONE .toLong(),
527526 (other.nanosecondsOfSecond - nanosecondsOfSecond).toLong(),
528527 unit.nanoseconds)
529- } catch (e : ArithmeticException ) {
528+ } catch (_ : ArithmeticException ) {
530529 if (this < other) Long .MAX_VALUE else Long .MIN_VALUE
531530 }
532531
@@ -577,7 +576,6 @@ public fun Instant.yearsUntil(other: Instant, timeZone: TimeZone): Int =
577576 * - Exactly zero if this instant is equal to the other.
578577 *
579578 * @throws DateTimeArithmeticException if `this` or [other] instant is too large to fit in [LocalDateTime].
580- * Or (only on the JVM) if the number of months between the two dates exceeds an Int.
581579 * @see Instant.periodUntil
582580 * @sample kotlinx.datetime.test.samples.InstantSamples.minusInstantInZone
583581 */
@@ -613,7 +611,7 @@ public fun Instant.minus(unit: DateTimeUnit, timeZone: TimeZone): Instant =
613611 *
614612 * The returned instant is later than this instant.
615613 *
616- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
614+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
617615 */
618616@Deprecated(" Use the plus overload with an explicit number of units" , ReplaceWith (" this.plus(1, unit)" ))
619617public fun Instant.plus (unit : DateTimeUnit .TimeBased ): Instant =
@@ -624,7 +622,7 @@ public fun Instant.plus(unit: DateTimeUnit.TimeBased): Instant =
624622 *
625623 * The returned instant is earlier than this instant.
626624 *
627- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
625+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
628626 */
629627@Deprecated(" Use the minus overload with an explicit number of units" , ReplaceWith (" this.minus(1, unit)" ))
630628public fun Instant.minus (unit : DateTimeUnit .TimeBased ): Instant =
@@ -669,7 +667,7 @@ public expect fun Instant.minus(value: Int, unit: DateTimeUnit, timeZone: TimeZo
669667 * If the [value] is positive, the returned instant is later than this instant.
670668 * If the [value] is negative, the returned instant is earlier than this instant.
671669 *
672- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
670+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
673671 *
674672 * @sample kotlinx.datetime.test.samples.InstantSamples.plusTimeBasedUnit
675673 */
@@ -682,7 +680,7 @@ public fun Instant.plus(value: Int, unit: DateTimeUnit.TimeBased): Instant =
682680 * If the [value] is positive, the returned instant is earlier than this instant.
683681 * If the [value] is negative, the returned instant is later than this instant.
684682 *
685- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
683+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
686684 *
687685 * @sample kotlinx.datetime.test.samples.InstantSamples.minusTimeBasedUnit
688686 */
@@ -730,7 +728,7 @@ public fun Instant.minus(value: Long, unit: DateTimeUnit, timeZone: TimeZone): I
730728 * If the [value] is positive, the returned instant is later than this instant.
731729 * If the [value] is negative, the returned instant is earlier than this instant.
732730 *
733- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
731+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
734732 *
735733 * @sample kotlinx.datetime.test.samples.InstantSamples.plusTimeBasedUnit
736734 */
@@ -742,7 +740,7 @@ public expect fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Insta
742740 * If the [value] is positive, the returned instant is earlier than this instant.
743741 * If the [value] is negative, the returned instant is later than this instant.
744742 *
745- * The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
743+ * The return value is clamped to the boundaries of [Instant] if the result exceeds them.
746744 *
747745 * @sample kotlinx.datetime.test.samples.InstantSamples.minusTimeBasedUnit
748746 */
0 commit comments