Class TimeHelper
- java.lang.Object
-
- org.hibernate.search.util.common.impl.TimeHelper
-
public final class TimeHelper extends Object
Helpers for classes in java.time.*
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ZonedDateTimeparseZoneDateTime(String value, DateTimeFormatter formatter)Workaround for https://bugs.openjdk.java.net/browse/JDK-8066982, which at the moment has only been solved for JDK9.static LongtoMillisecondsRoundedUp(Long time, TimeUnit timeUnit)Converts in milliseconds a time duration expressed withtimeandtimeUnit.
-
-
-
Method Detail
-
parseZoneDateTime
public static ZonedDateTime parseZoneDateTime(String value, DateTimeFormatter formatter)
Workaround for https://bugs.openjdk.java.net/browse/JDK-8066982, which at the moment has only been solved for JDK9.Tested against TCKDTFParsedInstant in http://hg.openjdk.java.net/jdk9/dev/jdk/rev/f371bdfb7875 with both JDK8b101 and JDK9 (early access - build 137).
- Parameters:
value- The value to be parsedformatter- The formatter to use when parsing- Returns:
- The parsed
ZonedDateTime
-
toMillisecondsRoundedUp
public static Long toMillisecondsRoundedUp(Long time, TimeUnit timeUnit)
Converts in milliseconds a time duration expressed withtimeandtimeUnit. The result value is rounded up. If either of the parameters is null, it will return null.- Parameters:
time- a time durationtimeUnit- the time unit used to express the duration- Returns:
- rounded up duration in milliseconds
-
-