core / io.islandtime.clock

Package io.islandtime.clock

The default clock implementation, providing access to the system clock at millisecond precision and a FixedClock for testing purposes.

Types

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

Clock

A time source.

interface Clock
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

FixedClock

A clock with fixed time, suitable for testing.

class FixedClock : Clock
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

SystemClock

A clock that provides the time from the current system.

class SystemClock : Clock

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

FixedClock

fun FixedClock(days: LongDays, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(days: IntDays, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(hours: LongHours, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(hours: IntHours, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(minutes: LongMinutes, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(minutes: IntMinutes, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(seconds: LongSeconds, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(seconds: IntSeconds, zone: TimeZone = TimeZone.UTC): FixedClock
fun FixedClock(milliseconds: IntMilliseconds, zone: TimeZone = TimeZone.UTC): FixedClock

Companion Object Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

now

Get the current Instant from the system clock.

fun Instant.Companion.now(): Instant

Get the current Instant from the specified clock.

fun Instant.Companion.now(clock: Clock): Instant

Get the current Year from the system clock.

fun Year.Companion.now(): Year

Get the current Year from the specified clock.

fun Year.Companion.now(clock: Clock): Year

Get the current YearMonth from the system clock.

fun YearMonth.Companion.now(): YearMonth

Get the current YearMonth from the specified clock.

fun YearMonth.Companion.now(clock: Clock): YearMonth

Get the current Date from the system clock.

fun Date.Companion.now(): Date

Get the current Date from the specified clock.

fun Date.Companion.now(clock: Clock): Date

Get the current DateTime from the system clock.

fun DateTime.Companion.now(): DateTime

Get the current DateTime from the specified clock.

fun DateTime.Companion.now(clock: Clock): DateTime

Get the current OffsetDateTime from the system clock.

fun OffsetDateTime.Companion.now(): OffsetDateTime

Get the current OffsetDateTime from the specified clock.

fun OffsetDateTime.Companion.now(clock: Clock): OffsetDateTime

Get the current OffsetTime from the system clock.

fun OffsetTime.Companion.now(): OffsetTime

Get the current OffsetTime from the specified clock.

fun OffsetTime.Companion.now(clock: Clock): OffsetTime

Get the current Time from the system clock.

fun Time.Companion.now(): Time

Get the current Time from the specified clock.

fun Time.Companion.now(clock: Clock): Time

Get the current ZonedDateTime from the system clock.

fun ZonedDateTime.Companion.now(): ZonedDateTime

Get the current ZonedDateTime from the specified clock.

fun ZonedDateTime.Companion.now(clock: Clock): ZonedDateTime
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

systemDefault

fun TimeZone.Companion.systemDefault(): TimeZone