重构验证码删除文件的实现逻辑 (#479)

* 重构验证码删除文件的实现逻辑

* 移除未使用的依赖

* 微调描述信息
This commit is contained in:
kl
2023-08-11 16:39:07 +08:00
committed by GitHub
parent aa49cc6ac0
commit 0a8be8ac95
7 changed files with 230 additions and 213 deletions

View File

@@ -0,0 +1,26 @@
package cn.keking.utils;
import java.time.Instant;
/**
* @author kl (http://kailing.pub)
* @since 2023/8/11
*/
public class DateUtils {
/**
* 获取当前时间的秒级时间戳
* @return
*/
public static long getCurrentSecond() {
return Instant.now().getEpochSecond();
}
/**
* 计算当前时间与指定时间的秒级时间戳差值
* @param datetime 指定时间
* @return 差值
*/
public static long calculateCurrentTimeDifference(long datetime) {
return getCurrentSecond() - datetime;
}
}