Class Stopwatch

java.lang.Object
de.uplanet.util.Stopwatch

@Scriptable public final class Stopwatch extends Object
Stopwatch with millisecond time resolution.
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final long
     
    static final long
     
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Create a stopwatch with millisecond resolution.
    Stopwatch(long p_lResolution)
    Create a stopwatch with a given resolution.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    long
    Get the meantime in milliseconds and reset to zero.
    Start the stopwatch.
    long
    Get the meantime in milliseconds.

    Methods inherited from class java.lang.Object Link icon

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

  • Constructor Details Link icon

    • Stopwatch Link icon

      public Stopwatch()
      Create a stopwatch with millisecond resolution.
    • Stopwatch Link icon

      public Stopwatch(long p_lResolution)
      Create a stopwatch with a given resolution.
      Parameters:
      p_lResolution - One of MILLIS, MICROS or NANOS.
  • Method Details Link icon

    • start Link icon

      public Stopwatch start()
      Start the stopwatch.
      Returns:
      This stopwatch.
    • stop Link icon

      public long stop()
      Get the meantime in milliseconds.
      Returns:
      The meantime in milliseconds.
    • restart Link icon

      public long restart()
      Get the meantime in milliseconds and reset to zero.
      Returns:
      The meantime in milliseconds.