本文整理匯總了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));
}