java.lang.Object
de.uplanet.lucy.server.scripting.velocity.util.Duration

public final class Duration extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Duration(int p_iDays, int p_iHours, int p_iMinutes, int p_iSeconds, int p_iMillis)
     
    Duration(long p_lDuration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the absolute, i.e.
    format(String p_strFormat)
    Format the given duration using the following format specifiers.
    long
    Get the days represented by this duration.
    long
    Get the full days represented by this duration.
    long
    Get the full hours represented by this duration.
    long
    Get the full milliseconds represented by this duration.
    long
    Get the full minutes represented by this duration.
    long
    Get the full seconds represented by this duration.
    long
    Get the hours represented by this duration without taking into account hours that are covered by full days.
    long
    Get the milliseconds represented by this duration without taking into account milliseconds that are covered by full seconds.
    long
    Get the minutes represented by this duration without taking into account minutes that are covered by full hours.
    long
    Get the seconds represented by this duration without taking into account seconds that are covered by full minutes.
    Round the duration to the nearest day.
    Round the duration to the nearest hour.
    Round the duration to the nearest minute.
    Round the duration to the nearest second.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Duration

      public Duration(long p_lDuration)
    • Duration

      public Duration(int p_iDays, int p_iHours, int p_iMinutes, int p_iSeconds, int p_iMillis)
  • Method Details

    • getFullDays

      public long getFullDays()
      Get the full days represented by this duration.
      Returns:
      The full days represented by this duration.
    • getDays

      public long getDays()
      Get the days represented by this duration.

      This is the same as getFullDays().

      Returns:
      The days represented by this duration.
    • getFullHours

      public long getFullHours()
      Get the full hours represented by this duration.
      Returns:
      The full hours represented by this duration.
    • getHours

      public long getHours()
      Get the hours represented by this duration without taking into account hours that are covered by full days.

      Eg. from getFullHours() == 25 follows getHours() == 1.

      Returns:
      The hours represented by this duration.
    • getFullMinutes

      public long getFullMinutes()
      Get the full minutes represented by this duration.
      Returns:
      The full minutes represented by this duration.
    • getMinutes

      public long getMinutes()
      Get the minutes represented by this duration without taking into account minutes that are covered by full hours.
      Returns:
      The minutes represented by this duration.
    • getFullSeconds

      public long getFullSeconds()
      Get the full seconds represented by this duration.
      Returns:
      The full seconds represented by this duration.
    • getSeconds

      public long getSeconds()
      Get the seconds represented by this duration without taking into account seconds that are covered by full minutes.
      Returns:
      The seconds represented by this duration.
    • getFullMilliseconds

      public long getFullMilliseconds()
      Get the full milliseconds represented by this duration.
      Returns:
      The full milliseconds represented by this duration.
    • getMilliseconds

      public long getMilliseconds()
      Get the milliseconds represented by this duration without taking into account milliseconds that are covered by full seconds.
      Returns:
      The milliseconds represented by this duration.
    • absolute

      public Duration absolute()
      Get the absolute, i.e. positive duration.
      Returns:
      The absolute duration.
    • roundToNearestDay

      public Duration roundToNearestDay()
      Round the duration to the nearest day.
      Returns:
      The rounded duration.
    • roundToNearestHour

      public Duration roundToNearestHour()
      Round the duration to the nearest hour.
      Returns:
      The rounded duration.
    • roundToNearestMinute

      public Duration roundToNearestMinute()
      Round the duration to the nearest minute.
      Returns:
      The rounded duration.
    • roundToNearestSecond

      public Duration roundToNearestSecond()
      Round the duration to the nearest second.
      Returns:
      The rounded duration.
    • format

      public String format(String p_strFormat)
      Format the given duration using the following format specifiers.
      Parameters:
      p_strFormat - The format string.
      Returns:
      The formatted duration.