guohongjin
2024-05-15 5b7639f0bd9e056738ec15100ed0532e965c6cd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cn.stylefeng.roses.kernel.demo.util;
 
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
 
import java.util.Date;
 
/**
 * 开始时间的计时工具
 *
 * @author fengshuonan
 * @date 2021/7/13 17:34
 */
public class StartCalcUtil {
 
    /**
     * 项目开始启动时间
     */
    public static Date startDate = null;
 
    /**
     * 初始化项目开始时间
     *
     * @author fengshuonan
     * @date 2021/7/13 17:42
     */
    public static void init(Date date) {
        startDate = date;
    }
 
    /**
     * 计算是否项目已经启动
     *
     * @author fengshuonan
     * @date 2021/7/13 17:43
     */
    public static boolean calcEnable(Date date, long startInterValSeconds) {
        return DateUtil.between(startDate, date, DateUnit.SECOND) > startInterValSeconds;
    }
 
}