java.lang.Object
com.microsoft.applicationinsights.telemetry.Duration

public final class Duration extends Object
This class lets its users define an interval of time which can be defined in terms of days, hours, minutes, seconds and milliseconds.

It has various constructors to let the user easily define an interval of time.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Duration(long duration)
    The duration is defined by milliseconds.
    Duration(long days, int hours, int minutes, int seconds, int milliseconds)
    The interval is set by setting all the possible values.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
    Gets the days part of the duration.
    int
    Gets the hours part of the duration.
    int
    Gets the milliseconds part of the duration.
    int
    Gets the minutes part of the duration.
    int
    Gets the seconds part of the duration.
    long
    Gets the total milliseconds of the duration.
    int
     
     

    Methods inherited from class java.lang.Object

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

    • Duration

      public Duration(long days, int hours, int minutes, int seconds, int milliseconds)
      The interval is set by setting all the possible values.
      Parameters:
      days - Day(s).
      hours - Hour(s) in range [-23, 23].
      minutes - Minute(s) in range [-59, 59].
      seconds - Second(s) in range [-59, 59].
      milliseconds - Milliseconds in range [0, 999].
    • Duration

      public Duration(long duration)
      The duration is defined by milliseconds. The class will calculate the number of days, hours, minutes, seconds and milliseconds from that value.
      Parameters:
      duration - The duration in milliseconds.
  • Method Details

    • getDays

      public long getDays()
      Gets the days part of the duration.
    • getHours

      public int getHours()
      Gets the hours part of the duration.
    • getMinutes

      public int getMinutes()
      Gets the minutes part of the duration.
    • getSeconds

      public int getSeconds()
      Gets the seconds part of the duration.
    • getMilliseconds

      public int getMilliseconds()
      Gets the milliseconds part of the duration.
    • getTotalMilliseconds

      public long getTotalMilliseconds()
      Gets the total milliseconds of the duration.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object