Duration

Duration

Duration 常用与表示时间间隔,30s

Duration heartbeatInterval = Duration.seconds(30);
heartbeatInterval.getSeconds();

通过Duration获取前3分钟的那个时刻的时间戳

Instant.now().plus(Duration.ofMinutes(-3)).truncatedTo(ChronoUnit.MINUTES).toEpochMilli()
posted @ 2023-07-07 13:47  SpecialSpeculator  阅读(349)  评论(0编辑  收藏  举报