本文整理汇总了Java中org.threeten.bp.Duration.ofMillis方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.ofMillis方法的具体用法?Java Duration.ofMillis怎么用?Java Duration.ofMillis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.Duration
的用法示例。
在下文中一共展示了Duration.ofMillis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newInfo
import org.threeten.bp.Duration; //导入方法依赖的package包/类
protected AccelerationData.Info newInfo(final Materialization materialization) {
final com.dremio.service.accelerator.proto.JobDetails details = materialization.getJob();
final Long jobStart = details.getJobStart();
final Long jobEnd = details.getJobEnd();
final AccelerationData.Info info = new AccelerationData.Info();
if (jobStart != null) {
info.setStart(DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(Instant.ofEpochMilli(jobStart), ZoneOffset.UTC)));
}
if (jobEnd != null) {
info.setEnd(DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(Instant.ofEpochMilli(jobEnd), ZoneOffset.UTC)));
}
if (jobStart != null && jobEnd != null) {
final Duration duration = Duration.ofMillis(jobEnd - jobStart);
info.setDuration(DateTimeFormatter.ISO_LOCAL_TIME.format(LocalTime.MIDNIGHT.plus(duration)));
}
info.setJobId(details.getJobId())
.setInputBytes(details.getInputBytes())
.setInputRecords(details.getInputRecords())
.setOutputBytes(details.getOutputBytes())
.setOutputRecords(details.getOutputRecords());
return info;
}
示例2: everyMillis
import org.threeten.bp.Duration; //导入方法依赖的package包/类
/**
* Create a schedule builder where events are triggered every {@code seconds}
*
* @param hours the number of minutes between events
* @return a schedule builder generating events every {@code seconds}
* @throws IllegalArgumentException if {@code minutes} is negative
*/
public static Builder everyMillis(long millis) {
return new Builder(Duration.ofMillis(millis));
}
示例3: getJvmUptime
import org.threeten.bp.Duration; //导入方法依赖的package包/类
/**
* Gets the uptime.
* @return the JVM uptime
*/
public Duration getJvmUptime() {
return Duration.ofMillis(ManagementFactory.getRuntimeMXBean().getUptime());
}