| 199 | } |
| 200 | |
| 201 | @Override |
| 202 | public String toString() { |
| 203 | long remainingNanos = timeRemaining(TimeUnit.NANOSECONDS); |
| 204 | long seconds = Math.abs(remainingNanos) / NANOS_PER_SECOND; |
| 205 | long nanos = Math.abs(remainingNanos) % NANOS_PER_SECOND; |
| 206 | |
| 207 | StringBuilder buf = new StringBuilder(); |
| 208 | if (remainingNanos < 0) { |
| 209 | buf.append('-'); |
| 210 | } |
| 211 | buf.append(seconds); |
| 212 | if (nanos > 0) { |
| 213 | buf.append(String.format(Locale.US, ".%09d", nanos)); |
| 214 | } |
| 215 | buf.append("s from now"); |
| 216 | if (ticker != SYSTEM_TICKER) { |
| 217 | buf.append(" (ticker=" + ticker + ")"); |
| 218 | } |
| 219 | return buf.toString(); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * {@inheritDoc} |