java.lang.Object
com.github.hypfvieh.util.TimeMeasure
Utility class for time measurements.
Instances may be reset for reuse.
Instances may be reset for reuse.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic StringformatDuration(double _millis) Converts a fractional milliseconds duration to a user-friendly formatted string e.g. for logging.longGets the elapsed time in milliseconds and resets the instance.Returns the elapsed time as a formatted, user-friendly string.longGets the elapsed time in milliseconds.doubleGets the elapsed time in fractional minutes.longGets the elapsed time in nanoseconds.longGets the elapsed time in seconds.reset()Resets the start time to current time.toString()Returns the elapsed time in milliseconds formatted as string by callinggetElapsedFormatted().
-
Konstruktordetails
-
TimeMeasure
public TimeMeasure()Default constructor with start time equals current time.
-
-
Methodendetails
-
reset
Resets the start time to current time.- Gibt zurück:
- the object
-
getElapsedMillis
public long getElapsedMillis()Gets the elapsed time in milliseconds.- Gibt zurück:
- elapsed time in milliseconds
-
getElapsedNanos
public long getElapsedNanos()Gets the elapsed time in nanoseconds.- Gibt zurück:
- elapsed time in nanoseconds
-
getElapsedSeconds
public long getElapsedSeconds()Gets the elapsed time in seconds.- Gibt zurück:
- elapsed time in seconds
-
getElapsedMinutes
public double getElapsedMinutes()Gets the elapsed time in fractional minutes.- Gibt zurück:
- elapsed time in minutes
-
getElapsedFormatted
Returns the elapsed time as a formatted, user-friendly string.- Gibt zurück:
- formatted string
-
getElapsedAndReset
public long getElapsedAndReset()Gets the elapsed time in milliseconds and resets the instance.- Gibt zurück:
- elapsed time
-
formatDuration
Converts a fractional milliseconds duration to a user-friendly formatted string e.g. for logging.- Parameter:
_millis- elapsed time in milliseconds- Gibt zurück:
- formatted string
-
toString
Returns the elapsed time in milliseconds formatted as string by callinggetElapsedFormatted().
-