【发布时间】:2018-04-06 10:26:10
【问题描述】:
考虑例子:
final Duration twoSeconds = Duration.ofSeconds(2);
// final long microseconds = twoSeconds.get(ChronoUnit.MICROS); throws UnsupportedTemporalTypeException: Unsupported unit: Micros
final long microseconds = twoSeconds.toNanos() / 1000L;
System.out.println(microseconds);
我想知道是否有比手动从纳秒转换更好的方法来获得以微秒为单位的持续时间。
【问题讨论】: