Generates a future date from now. Note that there is a 1 second slack to avoid generating a past date. @param atMost at most this amount of time ahead from now exclusive. @param unit the time unit. @return a future date from now.
(int atMost, TimeUnit unit)
| 34 | * @return a future date from now. |
| 35 | */ |
| 36 | public Date future(int atMost, TimeUnit unit) { |
| 37 | Date now = new Date(); |
| 38 | Date aBitLaterThanNow = new Date(now.getTime() + 1000); |
| 39 | return future(atMost, unit, aBitLaterThanNow); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Generates a future date from now, with a minimum time. |