Package org.lukashian.store
Class MillisecondStore
java.lang.Object
org.lukashian.store.MillisecondStore
For each
Day
and Year
, this class stores the number of milliseconds between the start of the calendar (the Lukashian epoch)
and the end of that day or year. It also stores the offset between the Lukashian epoch and the UNIX epoch. An implementation of
MillisecondStoreDataProvider
is used to obtain this data. By default, an instance of StandardEarthMillisecondStoreDataProvider
is used.
Alternative implementations of the MillisecondStoreDataProvider
can be provided using the Java Server Provider Interface mechanism. Simply
put a file named "org.lukashian.store.MillisecondStoreDataProvider" in META-INF/services/ on the classpath and put the fully qualified
name of the desired MillisecondStoreDataProvider
implementation as text in that file.
Alternatively, you could use the setMillisecondStoreDataProvider(org.lukashian.store.MillisecondStoreDataProvider)
of the INSTANCE
singleton.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the number of milliseconds from the start of the Lukashian Calendar until now.int
getEpochDayForEpochMilliseconds
(long epochMilliseconds) Gets the epoch day that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.long
getEpochMillisecondsForEpochDay
(int epochDay) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given day.long
getEpochMillisecondsForYear
(int year) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given year.long
getLukashianEpochMilliseconds
(long unixEpochMilliseconds) Gets the number of milliseconds from the start of the Lukashian Calendar until the given number of milliseconds from the UNIX Epoch.long
getUnixEpochMilliseconds
(long lukashianEpochMilliseconds) Gets the number of milliseconds from the UNIX Epoch until the given number of milliseconds from the Lukashian Epoch.int
getYearForEpochMilliseconds
(long epochMilliseconds) Gets the year that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.void
reload()
Reloads the durations of theYear
s,Day
s and the offset with the UNIX epoch from theMillisecondStoreDataProvider
.void
Sets theMillisecondStoreDataProvider
to the given instance and reloads thisMillisecondStore
.static MillisecondStore
store()
Gets the singleton instance of theMillisecondStore
.
-
Method Details
-
store
Gets the singleton instance of theMillisecondStore
. -
setMillisecondStoreDataProvider
Sets theMillisecondStoreDataProvider
to the given instance and reloads thisMillisecondStore
. -
reload
public void reload()Reloads the durations of theYear
s,Day
s and the offset with the UNIX epoch from theMillisecondStoreDataProvider
. -
getUnixEpochMilliseconds
public long getUnixEpochMilliseconds(long lukashianEpochMilliseconds) Gets the number of milliseconds from the UNIX Epoch until the given number of milliseconds from the Lukashian Epoch. -
getLukashianEpochMilliseconds
public long getLukashianEpochMilliseconds(long unixEpochMilliseconds) Gets the number of milliseconds from the start of the Lukashian Calendar until the given number of milliseconds from the UNIX Epoch. -
getCurrentEpochMilliseconds
public long getCurrentEpochMilliseconds()Gets the number of milliseconds from the start of the Lukashian Calendar until now. -
getEpochMillisecondsForYear
public long getEpochMillisecondsForYear(int year) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given year. -
getEpochMillisecondsForEpochDay
public long getEpochMillisecondsForEpochDay(int epochDay) Gets the number of milliseconds from the start of the Lukashian Calendar until the final point of the given day. The day is specified in epoch form, i.e. the how manieth day it is since the start of the Lukashian Calendar, irrespective of the year of the day. -
getYearForEpochMilliseconds
public int getYearForEpochMilliseconds(long epochMilliseconds) Gets the year that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar. -
getEpochDayForEpochMilliseconds
public int getEpochDayForEpochMilliseconds(long epochMilliseconds) Gets the epoch day that overlaps with the point where the given number of milliseconds have passed since the start of the Lukashian Calendar.
-