Obtains a clock that returns the current instant ticking in whole seconds using best available system clock. The current instant is converted to the instant of the specified time-zone.
package com.logicbig.example.clock;
import java.time.Clock;
import java.time.ZoneId;
public class TickSecondsExample {
public static void main(String... args) {
Clock c = Clock.tickSeconds(ZoneId.of("Canada/Central"));
System.out.println(c);
}
}
Output
TickClock[SystemClock[Canada/Central],PT1S]