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

org.smartboot.http.common.utils.TimerUtils Maven / Gradle / Ivy

There is a newer version: 2.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2017-2022, org.smartboot. All rights reserved.
 * project name: smart-http
 * file name: TimerUtils.java
 * Date: 2022-02-04
 * Author: sandao ([email protected])
 ******************************************************************************/

package org.smartboot.http.common.utils;

import org.smartboot.socket.timer.HashedWheelTimer;

import java.util.concurrent.TimeUnit;

/**
 * @author 三刀([email protected])
 * @version V1.0 , 2022/2/4
 */
public class TimerUtils {

    /**
     * 当前时间
     */
    private static long currentTimeMillis = System.currentTimeMillis();

    static {
        HashedWheelTimer.DEFAULT_TIMER.scheduleWithFixedDelay(() -> currentTimeMillis = System.currentTimeMillis(), 1, TimeUnit.SECONDS);
    }

    public static long currentTimeMillis() {
        return currentTimeMillis;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy