Top Fields Constructors Methods
org.keycloak.common.util

public Class Time

extends Object
Class Inheritance
Imports
java.util.Date

Author
Stian Thorgersen

Field Summary

Modifier and TypeField and Description
private static volatile int

Constructor Summary

AccessConstructor and Description
public
Time()

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

see description
currentTime
()

Returns current time in seconds adjusted by adding {@link #offset) seconds.

public static long

Returns:

see description
currentTimeMillis
()

Returns current time in milliseconds adjusted by adding {@link #offset) seconds.

public static int

Returns:

Time offset in seconds that will be added to currentTime() and currentTimeMillis().
getOffset
()

public static void
setOffset(int
Offset (in seconds)
offset
)

Sets time offset in seconds that will be added to currentTime() and currentTimeMillis().

public static Date

Returns:

see description
toDate
(int
Time in milliseconds since the epoch
time
)

Returns Date object, its value set to time

public static Date

Returns:

see description
toDate
(long
Time in milliseconds since the epoch
time
)

Returns Date object, its value set to time

public static long

Returns:

Time in milliseconds
toMillis
(long
Time in seconds since the epoch
time
)

Returns time in milliseconds for a time in seconds.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

offsetback to summary
private static volatile int offset

Constructor Detail

Timeback to summary
public Time()

Method Detail

currentTimeback to summary
public static int currentTime()

Returns current time in seconds adjusted by adding {@link #offset) seconds.

Returns:int

see description

currentTimeMillisback to summary
public static long currentTimeMillis()

Returns current time in milliseconds adjusted by adding {@link #offset) seconds.

Returns:long

see description

getOffsetback to summary
public static int getOffset()
Returns:int

Time offset in seconds that will be added to currentTime() and currentTimeMillis().

setOffsetback to summary
public static void setOffset(int offset)

Sets time offset in seconds that will be added to currentTime() and currentTimeMillis().

Parameters
offset:int

Offset (in seconds)

toDateback to summary
public static Date toDate(int time)

Returns Date object, its value set to time

Parameters
time:int

Time in milliseconds since the epoch

Returns:Date

see description

toDateback to summary
public static Date toDate(long time)

Returns Date object, its value set to time

Parameters
time:long

Time in milliseconds since the epoch

Returns:Date

see description

toMillisback to summary
public static long toMillis(long time)

Returns time in milliseconds for a time in seconds. No adjustment is made to the parameter.

Parameters
time:long

Time in seconds since the epoch

Returns:long

Time in milliseconds