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
    Modifier and Type
    Interface
    Description
    static class 
    An implementation of the Duration interface.
    static class 
    A duration whose end time is the present.
  • Method Summary

    Modifier and Type
    Method
    Description
    default long
    Returns the amount of time this duration represents (i.e. the amount of time between the start and end times) in milliseconds.
    long
    Returns the time this duration stopped as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
    long
    Returns the time this duration began as the number of milliseconds from the epoch (1970-01-01T00:00:00Z) in Coordinated Universal Time (UTC).
    static String
    toString(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

      static String toString(long milliseconds)
      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.