Class TimeUtils


  • public final class TimeUtils
    extends java.lang.Object
    Utility methods for dealing with time. Particularly duration.
    Since:
    3.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.time.Duration getDuration​(java.time.Instant started, java.time.Instant finished)
      Get the duration between when something was started and finished.
      • Methods inherited from class java.lang.Object

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

      • getDuration

        public static java.time.Duration getDuration​(@Nullable
                                                     java.time.Instant started,
                                                     @Nullable
                                                     java.time.Instant finished)
        Get the duration between when something was started and finished.
        Parameters:
        started - The start time. Can be null will automatically set the duration to 0
        finished - The finish time. If null will use (current time - started time) to get the duration
        Returns:
        The duration or zero if no duration