public class RealTimeClock extends Object implements Clock
System.nanoTime()
.Constructor and Description |
---|
RealTimeClock()
Constructs and starts the time count.
|
Modifier and Type | Method and Description |
---|---|
String |
format()
Deprecated.
|
double |
getHours()
Returns the elapsed time count in hours.
|
double |
getMilliSeconds()
Returns the elapsed time count in milliseconds.
|
double |
getMinutes()
Returns the elapsed time count in minutes.
|
double |
getNanoSeconds()
Returns the elapsed time in nanoseconds.
|
double |
getSeconds()
Returns the elapsed time count in seconds.
|
void |
init()
Resets the time count.
|
String |
toString()
Returns the string to print the
current count time in this format: "H:MM:SS:mmm".
|
static String |
toString(long msDuration)
Returns the time duration in
String with format: "H:MM:SS:mmm". |
public RealTimeClock()
init()
.public double getNanoSeconds()
public double getMilliSeconds()
Clock
getMilliSeconds
in interface Clock
public double getSeconds()
Clock
getSeconds
in interface Clock
public double getMinutes()
Clock
getMinutes
in interface Clock
public double getHours()
Clock
@Deprecated public String format()
public String toString()
public static String toString(long msDuration)
String
with format: "H:MM:SS:mmm".msDuration
- the time to print in milliseconds.