本文整理汇总了Java中org.threeten.bp.Duration.ofSeconds方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.ofSeconds方法的具体用法?Java Duration.ofSeconds怎么用?Java Duration.ofSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.Duration
的用法示例。
在下文中一共展示了Duration.ofSeconds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDaylightSavings
import org.threeten.bp.Duration; //导入方法依赖的package包/类
@Override
public Duration getDaylightSavings(Instant instant) {
ZoneOffset standardOffset = getStandardOffset(instant);
ZoneOffset actualOffset = getOffset(instant);
return Duration.ofSeconds(actualOffset.getTotalSeconds() - standardOffset.getTotalSeconds());
}
示例2: everySeconds
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 everySeconds(long seconds) {
return new Builder(Duration.ofSeconds(seconds));
}
示例3: getDuration
import org.threeten.bp.Duration; //导入方法依赖的package包/类
/**
* Gets the duration of the transition.
* <p>
* In most cases, the transition duration is one hour, however this is not always the case.
* The duration will be positive for a gap and negative for an overlap.
* Time-zones are second-based, so the nanosecond part of the duration will be zero.
*
* @return the duration of the transition, positive for gaps, negative for overlaps
*/
public Duration getDuration() {
return Duration.ofSeconds(getDurationSeconds());
}