Created
June 30, 2015 14:16
-
-
Save hishidama/6a2bf263608d09502d7b to your computer and use it in GitHub Desktop.
うるう秒が表示されるかどうか見てみる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.time; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
public class LeapSecondPrint { | |
public static void main(String... args) { | |
ZonedDateTime end = ZonedDateTime.of(2015, 7, 1, 0, 0, 2, 0, ZoneId.systemDefault()); | |
for (ZonedDateTime now = ZonedDateTime.now(), prev = null; now.compareTo(end) <= 0; prev = now, now = ZonedDateTime.now()) { | |
if (!now.equals(prev)) { | |
System.out.println(now); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment