final class Internal
extends java.lang.Object
com.google.common.util.concurrent
use only!Modifier | Constructor and Description |
---|---|
private |
Internal() |
Modifier and Type | Method and Description |
---|---|
(package private) static long |
toNanosSaturated(java.time.Duration duration)
Returns the number of nanoseconds of the given duration without throwing or overflowing.
|
static long toNanosSaturated(java.time.Duration duration)
Instead of throwing ArithmeticException
, this method silently saturates to either
Long.MAX_VALUE
or Long.MIN_VALUE
. This behavior can be useful when decomposing
a duration in order to call a legacy API which requires a long, TimeUnit
pair.