Package io.time
Class NanoSeconds
java.lang.Object
io.time.NanoSeconds
- All Implemented Interfaces:
Time
Class NanoSeconds.
-
Field Summary
Fields inherited from interface io.time.Time
MICROS_PER_MS, MICROS_PER_SEC, MS_PER_MIN, MS_PER_SEC, NS_PER_MICRO, NS_PER_MS, NS_PER_SEC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
convertToMicroSeconds
(double t) convert the time to Micro seconds.double
convertToMilliSeconds
(double t) convert the time to Milliseconds.double
convertToNanoSeconds
(double t) convert the time to Nanoseconds.double
elapsedMilliSeconds
(long h, long l) get the current Time.double
elapsedSeconds
(long h, long l) get the current Time.long
get the current Time.get the Time Unit.
-
Constructor Details
-
NanoSeconds
public NanoSeconds()
-
-
Method Details
-
getTimeUnit
get the Time Unit.- Specified by:
getTimeUnit
in interfaceTime
- Returns:
- time Unit in nanoseconds.;
-
getCurrentTime
public long getCurrentTime()get the current Time.- Specified by:
getCurrentTime
in interfaceTime
- Returns:
- current Time
-
elapsedMilliSeconds
public double elapsedMilliSeconds(long h, long l) get the current Time.- Specified by:
elapsedMilliSeconds
in interfaceTime
- Parameters:
h
- time stamp in Nano secondsl
- time stamp in nano seconds, the l should be less than h- Returns:
- elapsed time in milliseconds
-
elapsedSeconds
public double elapsedSeconds(long h, long l) get the current Time.- Specified by:
elapsedSeconds
in interfaceTime
- Parameters:
h
- time stamp in Nano seconds.l
- time stamp in Nano seconds, the l should be less than h- Returns:
- elapsed time in seconds
-
convertToNanoSeconds
public double convertToNanoSeconds(double t) convert the time to Nanoseconds.- Specified by:
convertToNanoSeconds
in interfaceTime
- Parameters:
t
- time duration in nanoseconds.- Returns:
- converted time in nanoseconds
-
convertToMicroSeconds
public double convertToMicroSeconds(double t) convert the time to Micro seconds.- Specified by:
convertToMicroSeconds
in interfaceTime
- Parameters:
t
- time duration in nanoseconds.- Returns:
- converted time in microseconds
-
convertToMilliSeconds
public double convertToMilliSeconds(double t) convert the time to Milliseconds.- Specified by:
convertToMilliSeconds
in interfaceTime
- Parameters:
t
- time duration in nanoseconds.- Returns:
- converted time in Milliseconds
-