Generates a past date from now. Note that there is a 1 second slack added. @param atMost at most this amount of time earlier from now exclusive. @param unit the time unit. @return a past date from now.
(int atMost, TimeUnit unit)
| 86 | * @return a past date from now. |
| 87 | */ |
| 88 | public Date past(int atMost, TimeUnit unit) { |
| 89 | Date now = new Date(); |
| 90 | Date aBitEarlierThanNow = new Date(now.getTime() - 1000); |
| 91 | return past(atMost, unit, aBitEarlierThanNow); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Generates a past date from now, with a minimum time. |