java.time.Clock.fixed() 方法示例


java.time.Clock.fixed() 方法示例

package com.codingdict;

import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;

public class ClockDemo {
   public static void main(String[] args) {

      Clock clock = Clock.fixed(Instant.ofEpochSecond(3600), ZoneId.systemDefault());
      Clock clock1 = Clock.fixed(Instant.ofEpochSecond(3600), ZoneId.systemDefault());

      System.out.println("Clock 1: " + clock.toString());
      System.out.println("Clock 2: " + clock1.toString());
   }
}