Package org.italiangrid.voms.util
Class TimeUtils
java.lang.Object
org.italiangrid.voms.util.TimeUtils
Time utilities.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckTimeInRangeWithSkew(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.static DateParses a date from string
-
Field Details
-
DATE_FORMATTER
-
-
Constructor Details
-
TimeUtils
private TimeUtils()
-
-
Method Details
-
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 checkedstartDate- the start date of the time rangeendDate- the end date of the time rangeskewInMinutes- the clock skew in minutes to take into account- Returns:
true, if the time is in the given range,falseotherwise- Throws:
IllegalArgumentException- if passed an illegal time range
-
parseDate
Parses a date from string- Parameters:
date- the date string representation;- Returns:
- the parsed date
- Throws:
NullPointerException- if date is nullDateTimeParseException- if the date is in the wrong format
-