@PublicAPI(stability=UNCOMMITTED, mayInstantiate=false, mayExtend=false, mayInvoke=true) public final class TimeThread extends Object
Modifier and Type | Method and Description |
---|---|
static Calendar |
getCalendar()
Retrieves a
Calendar containing the time at the last
update. |
static Date |
getDate()
Retrieves a
Date containing the time at the last
update. |
static String |
getGeneralizedTime()
Retrieves a string containing a normalized representation of the
current time in a generalized time format.
|
static String |
getGMTTime()
Retrieves a string containing the current time in GMT.
|
static int |
getHourAndMinute()
Retrieves an integer containing the time in HHmm format at the last
update.
|
static String |
getLocalTime()
Retrieves a string containing the current time in the local time
zone.
|
static long |
getNanoTime()
Retrieves the time in nanoseconds from the most precise available system
timer.
|
static long |
getTime()
Retrieves the time in milliseconds since the epoch at the last
update.
|
static String |
getUserDefinedTime(String formatString)
Retrieves the current time formatted using the given format string.
|
static void |
removeUserDefinedFormatter(String formatString)
Removes the user-defined time formatter from this time thread so
that it will no longer be maintained.
|
static void |
start()
Starts the time service if it has not already been started.
|
static void |
stop()
Stops the time service if it has not already been stopped.
|
public static Calendar getCalendar() throws IllegalStateException
Calendar
containing the time at the last
update.Calendar
containing the time at the last
update.IllegalStateException
- If the time service has not been started.public static Date getDate() throws IllegalStateException
Date
containing the time at the last
update.Date
containing the time at the last update.IllegalStateException
- If the time service has not been started.public static String getGeneralizedTime() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static String getGMTTime() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static int getHourAndMinute() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static String getLocalTime() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static long getNanoTime() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static long getTime() throws IllegalStateException
IllegalStateException
- If the time service has not been started.public static String getUserDefinedTime(String formatString) throws IllegalArgumentException, IllegalStateException
The first time this method is used with a given format string, it will be used to create a formatter that will generate the time string. That formatter will then be put into a list so that it will be maintained automatically for future use.
formatString
- The string that defines the format of the time string to
retrieve.IllegalArgumentException
- If the provided format string is invalid.IllegalStateException
- If the time service has not been started.public static void removeUserDefinedFormatter(String formatString) throws IllegalStateException
formatString
- The format string for the date formatter to remove.IllegalStateException
- If the time service has not been started.public static void start()
public static void stop()
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.