Class TimeUtils

java.lang.Object
io.micrometer.core.instrument.util.TimeUtils

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

    • convert

      public static double convert(double t, TimeUnit sourceUnit, TimeUnit destinationUnit)
    • nanosToUnit

      public static double nanosToUnit(double nanos, TimeUnit destinationUnit)
    • microsToUnit

      public static double microsToUnit(double micros, TimeUnit destinationUnit)
    • millisToUnit

      public static double millisToUnit(double millis, TimeUnit destinationUnit)
    • secondsToUnit

      public static double secondsToUnit(double seconds, TimeUnit destinationUnit)
    • minutesToUnit

      public static double minutesToUnit(double minutes, TimeUnit destinationUnit)
    • hoursToUnit

      public static double hoursToUnit(double hours, TimeUnit destinationUnit)
    • daysToUnit

      public static double daysToUnit(double days, TimeUnit destinationUnit)
    • simpleParse

      @Deprecated public static Duration simpleParse(String time)
      Deprecated.
      Parameters:
      time - A time string ending in human readable suffixes like 'ns', 'ms', 's'.
      Returns:
      A duration
    • format

      public static String format(Duration duration)