long runningHours = 0;
if (isCalendarsOnTheSameDay(start, stop)) {
runningHours = millisToCeiledHours(stopTime.getTime() - startTime.getTime());
LOGGER.debug("Stack ran less than a day. runningHours: {}", runningHours);
CloudbreakUsage cbUsageStart = getCloudbreakUsage(event, runningHours, startTime);
dailyStackUsageMap.put(DATE_FORMAT.format(startTime), cbUsageStart);
} else {
// get start day running hours
runningHours = runningHoursForDay(startTime, true);
CloudbreakUsage startDayUsage = getCloudbreakUsage(event, runningHours, startTime);
dailyStackUsageMap.put(DATE_FORMAT.format(startTime), startDayUsage);
LOGGER.debug("Generated start day usage: {}", startDayUsage);
// get stop day running hours
stopTime = stop.getTime();
runningHours = runningHoursForDay(stopTime, false);
if (runningHours > 0) {
Date startOfStopTimeDay = DATE_FORMAT.parse(DATE_FORMAT.format(stopTime));
CloudbreakUsage stopDayUsage = getCloudbreakUsage(event, runningHours, startOfStopTimeDay);
dailyStackUsageMap.put(DATE_FORMAT.format(stopTime), stopDayUsage);
LOGGER.debug("Generated stop day usage: {}", stopDayUsage);
}
generateAllDayStackUsages(startTime, stopTime, event, dailyStackUsageMap);