Interface Duration
- All Known Implementing Classes:
Duration.Adapter, Duration.Ongoing, ServerStatus.Playing, ServerStatus.Waiting, Session
public interface Duration
A duration is something that has both a
start time
and an end time.- Author:
- Stephen G. Ware
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault longReturns the amount of time this duration represents (i.e. the amount of time between the start and end times) in milliseconds.longReturns the time this duration stopped as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).longReturns the time this duration began as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).static StringtoString(long milliseconds) Converts a length of time into concise, human-readable text expressed as a number of days, hours, minutes, and seconds.
-
Method Details
-
toString
Converts a length of time into concise, human-readable text expressed as a number of days, hours, minutes, and seconds.- Parameters:
milliseconds- the length of time in milliseconds- Returns:
- the number of days, hours, minutes, and seconds in the given length of time
-
getStartTime
long getStartTime()Returns the time this duration began as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).- Returns:
- the time this duration began
-
getEndTime
long getEndTime()Returns the time this duration stopped as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).- Returns:
- the time this duration stopped
-
getDuration
default long getDuration()Returns the amount of time this duration represents (i.e. the amount of time between the start and end times) in milliseconds.- Returns:
- the number of milliseconds between the start and end times.
-