本文整理汇总了Java中java.time.ZonedDateTime.minusSeconds方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.minusSeconds方法的具体用法?Java ZonedDateTime.minusSeconds怎么用?Java ZonedDateTime.minusSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.minusSeconds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHealth
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public Health getHealth() {
HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration();
ZonedDateTime currentTime = currentTimeSupplier.get();
ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds());
OperationFilter filter = new OperationFilter.Builder().mtaId(healthCheckConfiguration.getMtaId())
.spaceId(healthCheckConfiguration.getSpaceId())
.user(healthCheckConfiguration.getUserName())
.endedAfter(Date.from(xSecondsAgo.toInstant()))
.inFinalState()
.orderByEndTime()
.descending()
.build();
List<Operation> healthCheckOperations = operationDao.find(filter);
return Health.fromOperations(healthCheckOperations);
}
示例2: initialize
import java.time.ZonedDateTime; //导入方法依赖的package包/类
public static void initialize(long size) {
for (long i = 0; i < size; ++i) {
PostMeta post = new PostMeta();
post.id = i;
post.ups = (int) (Math.random() * 10000);
post.downs = (int) (Math.random() * 10000);
ZonedDateTime date = ZonedDateTime.now();
date = date.minusHours((int) (Math.random() * 24 * 30 * 6));
date = date.minusSeconds((int) (Math.random() * 3600));
post.createdAt = date;
post.hot = (int) (Math.random() * 2000);
posts.add(post);
}
}
示例3: test_minusSeconds_seconds
import java.time.ZonedDateTime; //导入方法依赖的package包/类
@Test
public void test_minusSeconds_seconds() {
LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
ZonedDateTime test = base.minusSeconds(1);
assertEquals(test, ZonedDateTime.of(ldt.minusSeconds(1), ZONE_0100));
}