|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectframework.Time
public class Time
Provides methods to get the time as accurately as is possible.
Prior to Java 5, the only clock available was System.currentTimeMillis(), which on Windows has an resolution of about 10-16ms. This class will use the newer System.nanoTime() if it is available, falling back to System.currentTimeMillis() if necessary.
| Field Summary | |
|---|---|
static boolean |
nanoPrecision
True if we have access to the System.nanoTime() clock. |
| Constructor Summary | |
|---|---|
Time()
|
|
| Method Summary | |
|---|---|
static long |
getNanoTime()
Get current time in nanoseconds. |
static long |
getTime()
Get current time in milliseconds. |
static String |
toString(long time)
Convert from an number of milliseconds to a String in "[HH:]MM:SS" format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean nanoPrecision
System.nanoTime() clock.
| Constructor Detail |
|---|
public Time()
| Method Detail |
|---|
public static long getTime()
public static long getNanoTime()
public static String toString(long time)
String in "[HH:]MM:SS" format.
time - time in milliseconds
String containing a human-readable length of time
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||