Uses of Class
java.time.Clock

Packages that useClock
Package
Description
java.time
The main API for dates, times, instants, and durations.
java.time.chrono
Generic API for calendar systems other than the default ISO.
  • Uses ofClock injava.time

    Methods injava.time that returnClock
    Modifier and Type
    Method
    Description
    staticClock
    Clock.fixed(Instant fixedInstant,ZoneId zone)
    Obtains a clock that always returns the same instant.
    staticClock
    Clock.offset(Clock baseClock,Duration offsetDuration)
    Obtains a clock that returns instants from the specified clock with the specified duration added.
    staticClock
    Clock.system(ZoneId zone)
    Obtains a clock that returns the current instant using the best available system clock.
    staticClock
    Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the default time-zone.
    staticClock
    Clock.systemUTC()
    Obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone.
    staticClock
    Clock.tick(Clock baseClock,Duration tickDuration)
    Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.
    staticClock
    Clock.tickMillis(ZoneId zone)
    Obtains a clock that returns the current instant ticking in whole milliseconds using the best available system clock.
    staticClock
    Clock.tickMinutes(ZoneId zone)
    Obtains a clock that returns the current instant ticking in whole minutes using the best available system clock.
    staticClock
    Clock.tickSeconds(ZoneId zone)
    Obtains a clock that returns the current instant ticking in whole seconds using the best available system clock.
    abstractClock
    Clock.withZone(ZoneId zone)
    Returns a copy of this clock with a different time-zone.
    defaultClock
    InstantSource.withZone(ZoneId zone)
    Returns a clock with the specified time-zone.
    Methods injava.time with parameters of typeClock
    Modifier and Type
    Method
    Description
    staticInstant
    Instant.now(Clock clock)
    Obtains the current instant from the specified clock.
    staticLocalDate
    LocalDate.now(Clock clock)
    Obtains the current date from the specified clock.
    LocalDateTime.now(Clock clock)
    Obtains the current date-time from the specified clock.
    staticLocalTime
    LocalTime.now(Clock clock)
    Obtains the current time from the specified clock.
    staticMonthDay
    MonthDay.now(Clock clock)
    Obtains the current month-day from the specified clock.
    OffsetDateTime.now(Clock clock)
    Obtains the current date-time from the specified clock.
    OffsetTime.now(Clock clock)
    Obtains the current time from the specified clock.
    staticYear
    Year.now(Clock clock)
    Obtains the current year from the specified clock.
    staticYearMonth
    YearMonth.now(Clock clock)
    Obtains the current year-month from the specified clock.
    ZonedDateTime.now(Clock clock)
    Obtains the current date-time from the specified clock.
    staticClock
    Clock.offset(Clock baseClock,Duration offsetDuration)
    Obtains a clock that returns instants from the specified clock with the specified duration added.
    staticClock
    Clock.tick(Clock baseClock,Duration tickDuration)
    Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.
  • Uses ofClock injava.time.chrono

    Methods injava.time.chrono with parameters of typeClock
    Modifier and Type
    Method
    Description
    Chronology.dateNow(Clock clock)
    Obtains the current local date in this chronology from the specified clock.
    HijrahChronology.dateNow(Clock clock)
     
    IsoChronology.dateNow(Clock clock)
    Obtains the current ISO local date from the specified clock.
    JapaneseChronology.dateNow(Clock clock)
     
    MinguoChronology.dateNow(Clock clock)
     
    ThaiBuddhistChronology.dateNow(Clock clock)
     
    HijrahDate.now(Clock clock)
    Obtains the currentHijrahDate of the Islamic Umm Al-Qura calendar from the specified clock.
    JapaneseDate.now(Clock clock)
    Obtains the currentJapaneseDate from the specified clock.
    MinguoDate.now(Clock clock)
    Obtains the currentMinguoDate from the specified clock.
    ThaiBuddhistDate.now(Clock clock)
    Obtains the currentThaiBuddhistDate from the specified clock.