Class TimeUtils


  • public class TimeUtils
    extends Object
    Time utilities.
    Author:
    cecco
    • Method Detail

      • checkTimeInRangeWithSkew

        public static boolean checkTimeInRangeWithSkew​(Date timeToCheck,
                                                       Date startDate,
                                                       Date endDate,
                                                       int skewInMinutes)
        Checks that a date falls in the interval allowing for a certain clock skew expressed in minutes. The interval defined by (startDate, endDate) is modified to be (startDate - skewInMinutes, endDate + skewInMinutes).
        Parameters:
        timeToCheck - the time to be checked
        startDate - the start date of the time range
        endDate - the end date of the time range
        skewInMinutes - the clock skew in minutes to take into account
        Returns:
        true, if the time is in the given range, false otherwise
        Throws:
        IllegalArgumentException - if passed an illegal time range