Class TimeUtils


  • public final class TimeUtils
    extends java.lang.Object
    Modification on TimeUnit.convert(long, TimeUnit) that accepts and preserves precision from a double argument.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double convert​(double t, java.util.concurrent.TimeUnit sourceUnit, java.util.concurrent.TimeUnit destinationUnit)  
      static double daysToUnit​(double days, java.util.concurrent.TimeUnit destinationUnit)  
      static java.lang.String format​(java.time.Duration duration)  
      static double hoursToUnit​(double hours, java.util.concurrent.TimeUnit destinationUnit)  
      static double microsToUnit​(double micros, java.util.concurrent.TimeUnit destinationUnit)  
      static double millisToUnit​(double millis, java.util.concurrent.TimeUnit destinationUnit)  
      static double minutesToUnit​(double minutes, java.util.concurrent.TimeUnit destinationUnit)  
      static double nanosToUnit​(double nanos, java.util.concurrent.TimeUnit destinationUnit)  
      static double secondsToUnit​(double seconds, java.util.concurrent.TimeUnit destinationUnit)  
      static java.time.Duration simpleParse​(java.lang.String time)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • convert

        public static double convert​(double t,
                                     java.util.concurrent.TimeUnit sourceUnit,
                                     java.util.concurrent.TimeUnit destinationUnit)
      • nanosToUnit

        public static double nanosToUnit​(double nanos,
                                         java.util.concurrent.TimeUnit destinationUnit)
      • microsToUnit

        public static double microsToUnit​(double micros,
                                          java.util.concurrent.TimeUnit destinationUnit)
      • millisToUnit

        public static double millisToUnit​(double millis,
                                          java.util.concurrent.TimeUnit destinationUnit)
      • secondsToUnit

        public static double secondsToUnit​(double seconds,
                                           java.util.concurrent.TimeUnit destinationUnit)
      • minutesToUnit

        public static double minutesToUnit​(double minutes,
                                           java.util.concurrent.TimeUnit destinationUnit)
      • hoursToUnit

        public static double hoursToUnit​(double hours,
                                         java.util.concurrent.TimeUnit destinationUnit)
      • daysToUnit

        public static double daysToUnit​(double days,
                                        java.util.concurrent.TimeUnit destinationUnit)
      • simpleParse

        public static java.time.Duration simpleParse​(java.lang.String time)
      • format

        public static java.lang.String format​(java.time.Duration duration)