Class Duration


  • public class Duration
    extends Object
    User: Yohann Chastagnier Date: 14/11/13
    • Constructor Detail

      • Duration

        public Duration​(long time)
    • Method Detail

      • getTime

        public BigDecimal getTime()
        Gets the time in milliseconds.
        Returns:
        the time in milliseconds
      • getTimeAsLong

        public Long getTimeAsLong()
        Gets the time in milliseconds.
        Returns:
        the time in milliseconds.
      • getRoundedTimeConverted

        public BigDecimal getRoundedTimeConverted​(TimeUnit to)
        Gets the time converted to desired unit.
        Parameters:
        to - a time unit
        Returns:
        the time converted to desired unit.
      • getTimeConverted

        public BigDecimal getTimeConverted​(TimeUnit to)
        Gets the time converted to desired unit.
        Parameters:
        to - a time unit
        Returns:
        the time converted to desired unit.
      • getBestUnit

        public TimeUnit getBestUnit()
        Gets the best unit (for display as example).
        Returns:
        the best unit
      • getBestValue

        public BigDecimal getBestValue()
        Gets the best unformatted value (for display as example).
        Returns:
        the best unformatted value
      • getBestDisplayValueOnly

        public String getBestDisplayValueOnly()
        Gets the best display value
        Returns:
        the best display value
      • getBestDisplayValue

        public String getBestDisplayValue()
        Gets the best display value
        Returns:
        the best display value
      • getFormattedValueOnly

        public String getFormattedValueOnly​(TimeUnit to)
      • getFormattedValue

        public String getFormattedValue​(TimeUnit to)
      • getFormattedDurationAsHMSM

        public String getFormattedDurationAsHMSM()
      • getFormattedDurationAsHMS

        public String getFormattedDurationAsHMS()
      • getFormattedDuration

        public String getFormattedDuration​(String format)