(double seconds)
| 326 | * @since 2.0 |
| 327 | */ |
| 328 | public static MachineTime<TimeUnit> ofPosixSeconds(double seconds) { |
| 329 | |
| 330 | if (Double.isInfinite(seconds) || Double.isNaN(seconds)) { |
| 331 | throw new IllegalArgumentException("Invalid value: " + seconds); |
| 332 | } |
| 333 | |
| 334 | long secs = (long) Math.floor(seconds); |
| 335 | int fraction = (int) ((seconds - secs) * MRD); |
| 336 | return ofPosixUnits(secs, fraction); |
| 337 | |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * <p>Creates a machine time duration on the POSIX scale. </p> |