Klasse TimeMeasure

java.lang.Object
org.freedesktop.dbus.utils.TimeMeasure

public class TimeMeasure extends Object
Utility class for time measurements. Instances may be reset for reuse.
  • Konstruktordetails

    • TimeMeasure

      public TimeMeasure(TimeMeasure.ITimeMeasureFormat _formatter)
      Create a new instance using _ts millis as
      Parameter:
      _formatter - formatter to use for toString() call
    • TimeMeasure

      public TimeMeasure()
      Create a new instance, used a formatter converting everything >= 5000 ms to seconds (X.Y -> 6.1).
  • Methodendetails

    • reset

      public final TimeMeasure reset()
      Resets the start time.
      Gibt zurück:
      the object
    • getStartTime

      public long getStartTime()
      Returns the start time in milliseconds.
      Gibt zurück:
      start time in ms
    • getElapsed

      public long getElapsed()
      Returns the elapsed time in milliseconds.
      Gibt zurück:
      elapsed time in ms
    • getElapsedSeconds

      public long getElapsedSeconds()
      Returns the elapsed time in seconds.
      Gibt zurück:
      elapsed time in seconds
    • getElapsedFormatted

      public String getElapsedFormatted(DateFormat _dateFormat)
      Formats the elapsed time using the given dateFormatter. If null is given, a new Formatter with format HH:mm:ss.SSS will be used. The timezone of the given dateFormatter will always be set to 'UTC' to avoid any timezone related offsets.
      Parameter:
      _dateFormat - date format
      Gibt zurück:
      formatted string
    • getElapsedAndReset

      public long getElapsedAndReset()
    • toString

      public String toString()
      Returns the elapsed time in milliseconds formatted as string.
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      elapsed time in ms