11 |
|
import java.util.concurrent.*; |
12 |
|
import java.util.concurrent.atomic.AtomicReference; |
13 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
14 |
+ |
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
15 |
|
import java.security.CodeSource; |
16 |
|
import java.security.Permission; |
17 |
|
import java.security.PermissionCollection; |
624 |
|
} |
625 |
|
|
626 |
|
/** |
627 |
+ |
* Returns the number of milliseconds since time given by |
628 |
+ |
* startNanoTime, which must have been previously returned from a |
629 |
+ |
* call to {@link System.nanoTime()}. |
630 |
+ |
*/ |
631 |
+ |
long millisElapsedSince(long startNanoTime) { |
632 |
+ |
return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); |
633 |
+ |
} |
634 |
+ |
|
635 |
+ |
/** |
636 |
|
* Returns a new started daemon Thread running the given runnable. |
637 |
|
*/ |
638 |
|
Thread newStartedThread(Runnable runnable) { |