Package de.aristaflow.adept2.util.time
Class TimeCalculations
java.lang.Object
de.aristaflow.adept2.util.time.TimeCalculations
This class provides the means to incorporate local public holidays when doing
time calculations.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates new time calculations based on the default locale of the JVM.TimeCalculations(Locale locale) Creates new time calculations based on the designated locale, that is the localised public holidays. -
Method Summary
Modifier and TypeMethodDescriptiongetWorkingDayAfter(Calendar fromDate, int workingDaysToAdd) Calculates the next working day when adding the designated amount of workdays to the designated date.static longGets the time in the designated unit that is left of the designated duration since the designated start.
-
Constructor Details
-
TimeCalculations
public TimeCalculations()Creates new time calculations based on the default locale of the JVM. -
TimeCalculations
Creates new time calculations based on the designated locale, that is the localised public holidays.- Parameters:
locale- The locale to use for the time calculations.
-
-
Method Details
-
getWorkingDayAfter
Calculates the next working day when adding the designated amount of workdays to the designated date. The returned day will be a working day.- Parameters:
fromDate- The date to start the calculation.workingDaysToAdd- The amount of working days to add to the start date.- Returns:
- The working day which is the designated amount of working days after the designated date.
-
timeLeft
Gets the time in the designated unit that is left of the designated duration since the designated start. That isduration - (now - startInNanos)adjusted appropriately to the designated time unit.- Parameters:
startInNanos- The time in nanoseconds the waiting has started.duration- The time in the designated time unit, the waiting should take.unit- The unit of the duration and the calculated time left.- Returns:
- The time left of the designated duration in the designated time unit. If this is 0 or a negative value, the duration has elapsed.
-