Example usage for java.time Clock tick

List of usage examples for java.time Clock tick

Introduction

In this page you can find the example usage for java.time Clock tick.

Prototype

public static Clock tick(Clock baseClock, Duration tickDuration) 

Source Link

Document

Obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration.

Usage

From source file:Main.java

public static void main(String[] args) {
    Clock clock = Clock.tickMinutes(ZoneId.systemDefault());
    Duration duration = Duration.ofHours(3);
    Clock newClock = Clock.tick(clock, duration);

    System.out.println(newClock.instant());
}