51 |
|
* truncate, so lose precision. Conversions from coarser to finer |
52 |
|
* granularities with arguments that would numerically overflow |
53 |
|
* saturate to <tt>Long.MIN_VALUE</tt> if negative or |
54 |
< |
* <tt>Long>MAX_VALUE</tt> if positive. |
54 |
> |
* <tt>Long.MAX_VALUE</tt> if positive. |
55 |
|
* |
56 |
|
* @param duration the time duration in the given <tt>unit</tt> |
57 |
|
* @param unit the unit of the <tt>duration</tt> argument |
58 |
|
* @return the converted duration in the current unit, |
59 |
|
* or <tt>Long.MIN_VALUE</tt> if conversion would negatively |
60 |
< |
* overflow, or <tt>Long>MAX_VALUE</tt> if it would positively overflow. |
60 |
> |
* overflow, or <tt>Long.MAX_VALUE</tt> if it would positively overflow. |
61 |
|
*/ |
62 |
|
public long convert(long duration, TimeUnit unit) { |
63 |
|
if (unit == this) |
79 |
|
* @param duration the duration |
80 |
|
* @return the converted duration. |
81 |
|
* or <tt>Long.MIN_VALUE</tt> if conversion would negatively |
82 |
< |
* overflow, or <tt>Long>MAX_VALUE</tt> if it would positively overflow. |
82 |
> |
* overflow, or <tt>Long.MAX_VALUE</tt> if it would positively overflow. |
83 |
|
**/ |
84 |
|
public long toNanos(long duration) { |
85 |
|
if (index == NS) |