Package org.h2.util
Class TimeZoneProvider.WithTimeZone
java.lang.Object
org.h2.util.TimeZoneProvider
org.h2.util.TimeZoneProvider.WithTimeZone
- Enclosing class:
TimeZoneProvider
Time zone provider with time zone.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.h2.util.TimeZoneProvider
TimeZoneProvider.WithTimeZone
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final long
Number of seconds in 400 years.(package private) static final long
Number of seconds per year.private static DateTimeFormatter
private final ZoneId
Fields inherited from class org.h2.util.TimeZoneProvider
CACHE, UTC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
long
getEpochSecondsFromLocal
(long dateValue, long timeNanos) Calculates the epoch seconds from local date and time.getId()
Returns the ID of the time zone.getShortId
(long epochSeconds) Get the standard time name or daylight saving time name of the time zone.int
getTimeZoneOffsetLocal
(long dateValue, long timeNanos) Calculates the time zone offset in seconds for the specified date value and nanoseconds since midnight in local time.int
getTimeZoneOffsetUTC
(long epochSeconds) Calculates the time zone offset in seconds for the specified EPOCH seconds.int
hashCode()
toString()
private static int
yearForCalendar
(int year) Returns a year within the range -999,999,999..999,999,999 for the given year.Methods inherited from class org.h2.util.TimeZoneProvider
getDefault, hasFixedOffset, ofId, ofOffset
-
Field Details
-
SECONDS_PER_PERIOD
static final long SECONDS_PER_PERIODNumber of seconds in 400 years.- See Also:
-
SECONDS_PER_YEAR
static final long SECONDS_PER_YEARNumber of seconds per year.- See Also:
-
TIME_ZONE_FORMATTER
-
zoneId
-
-
Constructor Details
-
WithTimeZone
WithTimeZone(ZoneId timeZone)
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getTimeZoneOffsetUTC
public int getTimeZoneOffsetUTC(long epochSeconds) Description copied from class:TimeZoneProvider
Calculates the time zone offset in seconds for the specified EPOCH seconds.- Specified by:
getTimeZoneOffsetUTC
in classTimeZoneProvider
- Parameters:
epochSeconds
- seconds since EPOCH- Returns:
- time zone offset in minutes
-
getTimeZoneOffsetLocal
public int getTimeZoneOffsetLocal(long dateValue, long timeNanos) Description copied from class:TimeZoneProvider
Calculates the time zone offset in seconds for the specified date value and nanoseconds since midnight in local time.- Specified by:
getTimeZoneOffsetLocal
in classTimeZoneProvider
- Parameters:
dateValue
- date valuetimeNanos
- nanoseconds since midnight- Returns:
- time zone offset in minutes
-
getEpochSecondsFromLocal
public long getEpochSecondsFromLocal(long dateValue, long timeNanos) Description copied from class:TimeZoneProvider
Calculates the epoch seconds from local date and time.- Specified by:
getEpochSecondsFromLocal
in classTimeZoneProvider
- Parameters:
dateValue
- date valuetimeNanos
- nanoseconds since midnight- Returns:
- the epoch seconds value
-
getId
Description copied from class:TimeZoneProvider
Returns the ID of the time zone.- Specified by:
getId
in classTimeZoneProvider
- Returns:
- the ID of the time zone
-
getShortId
Description copied from class:TimeZoneProvider
Get the standard time name or daylight saving time name of the time zone.- Specified by:
getShortId
in classTimeZoneProvider
- Parameters:
epochSeconds
- seconds since EPOCH- Returns:
- the standard time name or daylight saving time name of the time zone
-
yearForCalendar
private static int yearForCalendar(int year) Returns a year within the range -999,999,999..999,999,999 for the given year. Too large and too small years are replaced with years within the range using the 400 years period of the Gregorian calendar. Because we need them only to calculate a time zone offset, it's safe to normalize them to such range.- Parameters:
year
- the year- Returns:
- the specified year or the replacement year within the range
-
toString
-