Class Duration

java.lang.Object
com.compomics.util.waiting.Duration

public class Duration extends Object
Class used to measure duration of a process.
Author:
Marc Vaudel
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for an empty instance.
    Duration(long start, long end)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end()
    Sets the end time to the system current time in milliseconds.
    long
    Returns the duration in milliseconds.
    void
    Sets the start time to the system current time in milliseconds.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Duration

      public Duration()
      Constructor for an empty instance. Start and end time can be set via the start() and end() methods.
    • Duration

      public Duration(long start, long end)
      Constructor.
      Parameters:
      start - the process start time in milliseconds
      end - the process end time in milliseconds
  • Method Details

    • start

      public void start()
      Sets the start time to the system current time in milliseconds.
    • end

      public void end()
      Sets the end time to the system current time in milliseconds.
    • getDuration

      public long getDuration()
      Returns the duration in milliseconds.
      Returns:
      the duration in milliseconds
    • toString

      public String toString()
      Overrides:
      toString in class Object