Class Duration

java.lang.Object
rosequartz.time.Duration

public class Duration extends Object
Represents a duration of time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Duration​(long duration)
    Creates a new duration representing the duration of time given in milliseconds.
    Duration​(long a, long b)
    Creates a new duration representing the duration of time between two unix-timestamps.
    Creates a new duration representing the duration of time between to moments.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Duration
    days​(double days)
    Creates a new duration representing the duration of a given amount of days.
    static Duration
    hours​(double hours)
    Creates a new duration representing the duration of a given amount of hours.
    double
    Gets the length in days.
    double
    Gets the length in hours.
    long
    Gets the length in milliseconds.
    double
    Gets the length in minutes.
    double
    Gets the length in seconds.
    static Duration
    millis​(long millis)
    Creates a new duration representing the duration of a given amount of milliseconds.
    static Duration
    minutes​(double minutes)
    Creates a new duration representing the duration of a given amount of minutes.
    static Duration
    seconds​(double seconds)
    Creates a new duration representing the duration of a given amount of seconds.
     

    Methods inherited from class java.lang.Object

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

    • Duration

      public Duration(long duration)
      Creates a new duration representing the duration of time given in milliseconds.
      Parameters:
      duration - duration in milliseconds
    • Duration

      public Duration(long a, long b)
      Creates a new duration representing the duration of time between two unix-timestamps.
      Parameters:
      a - either start or end time in unix millis
      b - either start or end time in unix millis
    • Duration

      public Duration(Moment a, Moment b)
      Creates a new duration representing the duration of time between to moments.
      Parameters:
      a - moment representing either start or end of duration
      b - moment representing either start or end of duration
  • Method Details

    • millis

      public static Duration millis(long millis)
      Creates a new duration representing the duration of a given amount of milliseconds.
      Parameters:
      millis - milliseconds
      Returns:
      duration
    • seconds

      public static Duration seconds(double seconds)
      Creates a new duration representing the duration of a given amount of seconds.
      Parameters:
      seconds - seconds
      Returns:
      duration
    • minutes

      public static Duration minutes(double minutes)
      Creates a new duration representing the duration of a given amount of minutes.
      Parameters:
      minutes - minutes
      Returns:
      duration
    • hours

      public static Duration hours(double hours)
      Creates a new duration representing the duration of a given amount of hours.
      Parameters:
      hours - hours
      Returns:
      duration
    • days

      public static Duration days(double days)
      Creates a new duration representing the duration of a given amount of days.
      Parameters:
      days - days
      Returns:
      duration
    • lengthMillis

      public long lengthMillis()
      Gets the length in milliseconds.
      Returns:
      length in milliseconds
    • lengthSeconds

      public double lengthSeconds()
      Gets the length in seconds.
      Returns:
      length in seconds
    • lengthMinutes

      public double lengthMinutes()
      Gets the length in minutes.
      Returns:
      length in minutes
    • lengthHours

      public double lengthHours()
      Gets the length in hours.
      Returns:
      length in hours
    • lengthDays

      public double lengthDays()
      Gets the length in days.
      Returns:
      length in days
    • toString

      public String toString()
      Overrides:
      toString in class Object