Package io.islandtime.measures¶
common
Classes related to the measurement of time, including Duration
, Period
, and more specific units, such as Hours
or Years
.
Types¶
Name | Summary |
---|---|
Centuries | common @JvmInline |
Days | common @JvmInline |
Decades | common @JvmInline |
Duration | common class Duration : Comparable<Duration> A duration of time at nanosecond precision. |
Hours | common @JvmInline |
Microseconds | common @JvmInline |
Milliseconds | common @JvmInline |
Minutes | common @JvmInline |
Months | common @JvmInline |
Nanoseconds | common @JvmInline |
Period | common class Period A date-based period of time, such as "2 years, 5 months, 16 days". Unlike Duration, which uses exact increments, a Period works with conceptual days, months, and years, ignoring daylight savings and length differences. |
Seconds | common @JvmInline |
TimeUnit | common enum TimeUnit : Enum<TimeUnit> A unit of time measurement. |
Weeks | common @JvmInline |
Years | common @JvmInline |
Functions¶
Name | Summary |
---|---|
abs | common fun abs(duration: Duration): Duration Returns the absolute value of a duration. |
asDuration | common fun Days.asDuration(): Duration fun Hours.asDuration(): Duration fun Microseconds.asDuration(): Duration fun Milliseconds.asDuration(): Duration fun Minutes.asDuration(): Duration fun Nanoseconds.asDuration(): Duration fun Seconds.asDuration(): Duration |
asPeriod | common fun Days.asPeriod(): Period Converts this duration into a Period with the same number of days. common fun Months.asPeriod(): Period Converts this duration into a Period with the same number of months. common fun Weeks.asPeriod(): Period Converts this duration into a Period with the same number of weeks. common fun Years.asPeriod(): Period Converts this duration into a Period with the same number of years. |
durationOf | common fun durationOf(days: Days): Duration Creates a Duration of 24-hour days. common fun durationOf(hours: Hours): Duration Creates a Duration of hours. common fun durationOf(microseconds: Microseconds): Duration Creates a Duration of microseconds. common fun durationOf(milliseconds: Milliseconds): Duration Creates a Duration of milliseconds. common fun durationOf(minutes: Minutes): Duration Creates a Duration of minutes. common fun durationOf(nanoseconds: Nanoseconds): Duration Creates a Duration of nanoseconds. common fun durationOf(seconds: Seconds): Duration Creates a Duration of seconds. common fun durationOf(seconds: Seconds, nanoseconds: Nanoseconds): Duration Creates a Duration. |
minus | common operator fun Days.minus(period: Period): Period operator fun Months.minus(period: Period): Period operator fun Weeks.minus(period: Period): Period operator fun Years.minus(period: Period): Period |
periodOf | common fun periodOf(days: Days): Period fun periodOf(weeks: Weeks): Period fun periodOf(months: Months, days: Days = 0.days): Period fun periodOf(years: Years, days: Days): Period fun periodOf(years: Years, months: Months = 0.months, days: Days = 0.days): Period Creates a Period. |
plus | common operator fun Days.plus(period: Period): Period operator fun Months.plus(period: Period): Period operator fun Weeks.plus(period: Period): Period operator fun Years.plus(period: Period): Period |
times | common operator fun Int.times(centuries: Centuries): Centuries operator fun Long.times(centuries: Centuries): Centuries Multiplies this value by a duration of centuries. @throws ArithmeticException if overflow occurs common operator fun Int.times(days: Days): Days operator fun Long.times(days: Days): Days Multiplies this value by a duration of days. @throws ArithmeticException if overflow occurs common operator fun Int.times(decades: Decades): Decades operator fun Long.times(decades: Decades): Decades Multiplies this value by a duration of decades. @throws ArithmeticException if overflow occurs common operator fun Int.times(duration: Duration): Duration Multiplies this value by a duration. common operator fun Int.times(hours: Hours): Hours operator fun Long.times(hours: Hours): Hours Multiplies this value by a duration of hours. @throws ArithmeticException if overflow occurs common operator fun Int.times(microseconds: Microseconds): Microseconds operator fun Long.times(microseconds: Microseconds): Microseconds Multiplies this value by a duration of microseconds. @throws ArithmeticException if overflow occurs common operator fun Int.times(milliseconds: Milliseconds): Milliseconds operator fun Long.times(milliseconds: Milliseconds): Milliseconds Multiplies this value by a duration of milliseconds. @throws ArithmeticException if overflow occurs common operator fun Int.times(minutes: Minutes): Minutes operator fun Long.times(minutes: Minutes): Minutes Multiplies this value by a duration of minutes. @throws ArithmeticException if overflow occurs common operator fun Int.times(months: Months): Months operator fun Long.times(months: Months): Months Multiplies this value by a duration of months. @throws ArithmeticException if overflow occurs common operator fun Int.times(nanoseconds: Nanoseconds): Nanoseconds operator fun Long.times(nanoseconds: Nanoseconds): Nanoseconds Multiplies this value by a duration of nanoseconds. @throws ArithmeticException if overflow occurs common operator fun Int.times(period: Period): Period operator fun Long.times(period: Period): Period common operator fun Int.times(seconds: Seconds): Seconds operator fun Long.times(seconds: Seconds): Seconds Multiplies this value by a duration of seconds. @throws ArithmeticException if overflow occurs common operator fun Int.times(weeks: Weeks): Weeks operator fun Long.times(weeks: Weeks): Weeks Multiplies this value by a duration of weeks. @throws ArithmeticException if overflow occurs common operator fun Int.times(years: Years): Years operator fun Long.times(years: Years): Years Multiplies this value by a duration of years. @throws ArithmeticException if overflow occurs |
toDuration | common fun String.toDuration(): Duration Converts an ISO-8601 duration string to a Duration. common fun String.toDuration(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Duration Converts a string to a Duration using parser. |
toIslandDays | common fun Duration.toIslandDays(): Days Converts this duration to Island Time Days. |
toIslandDuration | common fun Duration.toIslandDuration(): Duration Converts this duration to an equivalent Island Time Duration. |
toIslandHours | common fun Duration.toIslandHours(): Hours Converts this duration to Island Time Hours. |
toIslandMicroseconds | common fun Duration.toIslandMicroseconds(): Microseconds Converts this duration to Island Time Microseconds. |
toIslandMilliseconds | common fun Duration.toIslandMilliseconds(): Milliseconds Converts this duration to Island Time Milliseconds. |
toIslandMinutes | common fun Duration.toIslandMinutes(): Minutes Converts this duration to Island Time Minutes. |
toIslandNanoseconds | common fun Duration.toIslandNanoseconds(): Nanoseconds Converts this duration to Island Time Nanoseconds. |
toIslandSeconds | common fun Duration.toIslandSeconds(): Seconds Converts this duration to Island Time Seconds. |
toPeriod | common fun String.toPeriod(): Period fun String.toPeriod(parser: DateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): Period |
Properties¶
Name | Summary |
---|---|
centuries | common val Int.centuries: Centuries Converts this value to a duration of centuries. |
centuries | common val Long.centuries: Centuries Converts this value to a duration of centuries. |
days | common val Int.days: Days Converts this value to a duration of days. |
days | common val Long.days: Days Converts this value to a duration of days. |
decades | common val Int.decades: Decades Converts this value to a duration of decades. |
decades | common val Long.decades: Decades Converts this value to a duration of decades. |
hours | common val Int.hours: Hours Converts this value to a duration of hours. |
hours | common val Long.hours: Hours Converts this value to a duration of hours. |
microseconds | common val Int.microseconds: Microseconds Converts this value to a duration of microseconds. |
microseconds | common val Long.microseconds: Microseconds Converts this value to a duration of microseconds. |
milliseconds | common val Int.milliseconds: Milliseconds Converts this value to a duration of milliseconds. |
milliseconds | common val Long.milliseconds: Milliseconds Converts this value to a duration of milliseconds. |
minutes | common val Int.minutes: Minutes Converts this value to a duration of minutes. |
minutes | common val Long.minutes: Minutes Converts this value to a duration of minutes. |
months | common val Int.months: Months Converts this value to a duration of months. |
months | common val Long.months: Months Converts this value to a duration of months. |
nanoseconds | common val Int.nanoseconds: Nanoseconds Converts this value to a duration of nanoseconds. |
nanoseconds | common val Long.nanoseconds: Nanoseconds Converts this value to a duration of nanoseconds. |
seconds | common val Int.seconds: Seconds Converts this value to a duration of seconds. |
seconds | common val Long.seconds: Seconds Converts this value to a duration of seconds. |
weeks | common val Int.weeks: Weeks Converts this value to a duration of weeks. |
weeks | common val Long.weeks: Weeks Converts this value to a duration of weeks. |
years | common val Int.years: Years Converts this value to a duration of years. |
years | common val Long.years: Years Converts this value to a duration of years. |