Package rosequartz.time
Class Duration
java.lang.Object
rosequartz.time.Duration
Represents a duration of time.
-
Constructor Summary
ConstructorsConstructorDescriptionDuration(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 TypeMethodDescriptionstatic Durationdays(double days)Creates a new duration representing the duration of a given amount of days.static Durationhours(double hours)Creates a new duration representing the duration of a given amount of hours.doubleGets the length in days.doubleGets the length in hours.longGets the length in milliseconds.doubleGets the length in minutes.doubleGets the length in seconds.static Durationmillis(long millis)Creates a new duration representing the duration of a given amount of milliseconds.static Durationminutes(double minutes)Creates a new duration representing the duration of a given amount of minutes.static Durationseconds(double seconds)Creates a new duration representing the duration of a given amount of seconds.toString()
-
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 millisb- either start or end time in unix millis
-
Duration
Creates a new duration representing the duration of time between to moments.- Parameters:
a- moment representing either start or end of durationb- moment representing either start or end of duration
-
-
Method Details
-
millis
Creates a new duration representing the duration of a given amount of milliseconds.- Parameters:
millis- milliseconds- Returns:
- duration
-
seconds
Creates a new duration representing the duration of a given amount of seconds.- Parameters:
seconds- seconds- Returns:
- duration
-
minutes
Creates a new duration representing the duration of a given amount of minutes.- Parameters:
minutes- minutes- Returns:
- duration
-
hours
Creates a new duration representing the duration of a given amount of hours.- Parameters:
hours- hours- Returns:
- duration
-
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
-