org.keycloak.common.util

## Class Time

- java.lang.Object
- - org.keycloak.common.util.Time

-     public class Time
      extends Object

  Author:
    Stian Thorgersen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Time()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `currentTime()` Returns current time in seconds adjusted by adding {@link #offset) seconds.
    `static long` | `currentTimeMillis()` Returns current time in milliseconds adjusted by adding {@link #offset) seconds.
    `static int` | `getOffset()`
    `static void` | `setOffset(int offset)` Sets time offset in seconds that will be added to `currentTime()` and `currentTimeMillis()`.
    `static Date` | `toDate(int time)` Returns `Date` object, its value set to time
    `static Date` | `toDate(long time)` Returns `Date` object, its value set to time
    `static long` | `toMillis(long time)` Returns time in milliseconds for a time in seconds.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Time

          public Time()

  - ### Method Detail

    - #### currentTime

          public static int currentTime()

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

    - #### currentTimeMillis

          public static long currentTimeMillis()

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

    - #### toDate

          public static Date toDate(int time)

      Returns `Date` object, its value set to time
      Parameters:
        `time` - Time in milliseconds since the epoch
      Returns:
        see description

    - #### toDate

          public static Date toDate(long time)

      Returns `Date` object, its value set to time
      Parameters:
        `time` - Time in milliseconds since the epoch
      Returns:
        see description

    - #### toMillis

          public static long toMillis(long time)

      Returns time in milliseconds for a time in seconds. No adjustment is made to the parameter.
      Parameters:
        `time` - Time in seconds since the epoch
      Returns:
        Time in milliseconds

    - #### getOffset

          public static int getOffset()

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

    - #### setOffset

          public static void setOffset(int offset)

      Sets time offset in seconds that will be added to `currentTime()` and `currentTimeMillis()`.
      Parameters:
        `offset` - Offset (in seconds)

Copyright © 2021 JBoss by Red Hat. All rights reserved.