Class TimeProviderBase
java.lang.Object
com.sportradar.livedata.sdk.common.timer.TimeProviderBase
- Direct Known Subclasses:
RealTimeTimeProvider,TimeProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static TimeProviderBaseCurrently usedTimeProviderBaseinstance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeProviderBaseGets the currently usedTimeProviderBaseinstance.org.joda.time.DateTimeabstract DategetDate()When overridden in derived class, gets theDatespecifying the current date and time.abstract org.joda.time.DateTimeWhen overridden in derived class, gets theDateTimespecifying the current date and time.getFutureDate(long millis) Adds millis to current datestatic voidSets the currently usedTimeProviderBaseto default one which uses system time.static voidsetCurrent(TimeProviderBase provider) Sets the currently usedTimeProviderBaseinstance.
-
Field Details
-
current
Currently usedTimeProviderBaseinstance.
-
-
Constructor Details
-
TimeProviderBase
public TimeProviderBase()
-
-
Method Details
-
getCurrent
Gets the currently usedTimeProviderBaseinstance.- Returns:
- The currently used
TimeProviderBaseinstance.
-
getDateTime
public abstract org.joda.time.DateTime getDateTime()When overridden in derived class, gets theDateTimespecifying the current date and time.- Returns:
- the
DateTimespecifying the current date and time.
-
getCurrentTime
public org.joda.time.DateTime getCurrentTime() -
getDate
When overridden in derived class, gets theDatespecifying the current date and time.- Returns:
- The
Datespecifying the current date and time.
-
setCurrent
Sets the currently usedTimeProviderBaseinstance.- Parameters:
provider- TheTimeProviderBaseto be used.- Throws:
IllegalArgumentException- Theprovideris a null reference.
-
resetToRealTime
public static void resetToRealTime()Sets the currently usedTimeProviderBaseto default one which uses system time. -
getFutureDate
Adds millis to current date- Parameters:
millis- milliseconds to add to current date- Returns:
- The
Datespecifying future date and time
-