本文整理匯總了Java中org.joda.time.DateTimeConstants.SECONDS_PER_DAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeConstants.SECONDS_PER_DAY屬性的具體用法?Java DateTimeConstants.SECONDS_PER_DAY怎麽用?Java DateTimeConstants.SECONDS_PER_DAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.joda.time.DateTimeConstants
的用法示例。
在下文中一共展示了DateTimeConstants.SECONDS_PER_DAY屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldScheduleInterveningRepeatJobWithoutEndDate
@Test
public void shouldScheduleInterveningRepeatJobWithoutEndDate() throws SchedulerException {
try {
fakeNow(newDateTime(2020, 7, 15, 10, 0, 0));
Map<String, Object> params = new HashMap<>();
params.put(MotechSchedulerService.JOB_ID_KEY, "job_id");
RepeatingSchedulableJob repeatJob = new RepeatingSchedulableJob(
new MotechEvent("test_event", params),
3,
DateTimeConstants.SECONDS_PER_DAY,
newDateTime(2020, 7, 13, 12, 0, 0),
null,
true);
repeatJob.setUseOriginalFireTimeAfterMisfire(false);
schedulerService.scheduleRepeatingJob(repeatJob);
List<DateTime> fireTimes = getFireTimes("test_event-job_id-repeat");
assertEquals(asList(
newDateTime(2020, 7, 15, 12, 0, 0),
newDateTime(2020, 7, 16, 12, 0, 0)),
fireTimes);
} finally {
stopFakingTime();
}
}
示例2: durationAsString
public static String durationAsString(double duration) {
long d = Double.valueOf(duration * DateTimeConstants.MILLIS_PER_SECOND).longValue();
long days = d / (DateTimeConstants.SECONDS_PER_DAY * DateTimeConstants.MILLIS_PER_SECOND);
long secs = d % (DateTimeConstants.SECONDS_PER_DAY * DateTimeConstants.MILLIS_PER_SECOND);
Period p = new Period(secs);
return "" + days + " d " + periodFormatter.print(p);
}