Class TimeSpan


  • public class TimeSpan
    extends Object
    Represents a time span counted by an instance of the Timer.
    Since:
    2.0.0
    • Constructor Detail

      • TimeSpan

        public TimeSpan​(long milliseconds)
        Constructs a new instance.
        Parameters:
        milliseconds - a counted time span in the milliseconds.
        Since:
        2.0.0
    • Method Detail

      • toMilliseconds

        public long toMilliseconds()
        Returns milliseconds representation of this object.
        Returns:
        this in milliseconds.
        Since:
        2.0.0
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Returns a string representation of the time span in human-readable format. Examples:
         0 seconds
         589 milliseconds
         1 second
         57 seconds 42 milliseconds
         1 minute
         2 minutes 1 millisecond
         7 minutes 1 second
         12 minutes 28 seconds 321 milliseconds
         1 hour
         5 hours
         5 hours 1 second
         5 hours 1 minute 54 seconds 132 milliseconds
         5 hours 9 minutes 4 seconds 123 milliseconds
         
        Overrides:
        toString in class Object
        Returns:
        a string representation of the time in human-readable format.
        Since:
        2.0.0