org.wso2.carbon.governance.api.util

## Class CheckpointTimeUtils

- java.lang.Object
- - org.wso2.carbon.governance.api.util.CheckpointTimeUtils

-     public class CheckpointTimeUtils
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CheckpointTimeUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `calculateTimeDifference(String timeStampOne, String timeStampTwo)` This method used to calculate time difference of two timestamps.
    `static long` | `calculateTimeDifferenceToPresent(String timeStamp)` This method used to calculate time difference between timestamp to present.
    `static String` | `formatTimeDuration(long duration)` This method is used to format a timestamp to 'dd:hh:mm:ss'.
    `static String` | `getCurrentTime()` This method is used to current time
    `static long` | `getMillySecondsByDuration(String duration)` This method is used to get duration in milly seconds by passing the duration as a String.
    `static boolean` | `isDurationBetweenTimestamps(long duration, String minTime, String maxTime)` This method used to check whether a duration is between a specific boundary.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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'.

Copyright © 2017 WSO2. All Rights Reserved.