Class CheckpointTimeUtils


  • public class CheckpointTimeUtils
    extends Object
    • Constructor Detail

      • CheckpointTimeUtils

        public CheckpointTimeUtils()
    • Method Detail

      • isDurationBetweenTimestamps

        public static boolean isDurationBetweenTimestamps​(long duration,
                                                          String minTime,
                                                          String maxTime)
        This method used to check whether a duration is between a specific boundary.
        Parameters:
        duration - lifecycle current state duration timestamp.
        minTime - boundary lower value.
        maxTime - boundary upper value.
        Returns:
        true when duration is between the boundary.
      • getMillySecondsByDuration

        public static long getMillySecondsByDuration​(String duration)
        This method is used to get duration in milly seconds by passing the duration as a String.
        Parameters:
        duration - duration as a String.
        Returns:
        duration in milly seconds.
      • calculateTimeDifference

        public static long calculateTimeDifference​(String timeStampOne,
                                                   String timeStampTwo)
        This method used to calculate time difference of two timestamps.
        Parameters:
        timeStampOne - latest timestamp.
        timeStampTwo - earlier timestamp.
        Returns:
        timeDurationTimestamp timestamp difference from current time to current lifecycle last state changed time.
      • calculateTimeDifferenceToPresent

        public static long calculateTimeDifferenceToPresent​(String timeStamp)
        This method used to calculate time difference between timestamp to present.
        Parameters:
        timeStamp - earlier timestamp.
        Returns:
        timeDurationTimestamp timestamp difference from current time to current lifecycle last state changed time.
      • getCurrentTime

        public static String getCurrentTime()
        This method is used to current time
        Returns:
        String current time in yyyy-MM-dd HH:mm:ss.SSS format.
      • formatTimeDuration

        public static String formatTimeDuration​(long duration)
        This method is used to format a timestamp to 'dd:hh:mm:ss'.
        Parameters:
        duration - timestamp duration.
        Returns:
        formatted time duration to 'dd:hh:mm:ss'.