All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.keycloak.util.Time Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
package org.keycloak.util;

import java.util.Date;

/**
 * @author Stian Thorgersen
 */
public class Time {

    private static int offset;

    public static int currentTime() {
        return ((int) (System.currentTimeMillis() / 1000)) + offset;
    }

    public static Date toDate(int time) {
        return new Date(((long) time ) * 1000);
    }

    public static long toMillis(int time) {
        return ((long) time) * 1000;
    }

    public static void setOffset(int offset) {
        Time.offset = offset;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy