@Test public void testCalcWorkingTime() throws Exception { assertEquals(0, DateTimeUtils.calcWorkingTime(0, 0, 0)); assertEquals(60, DateTimeUtils.calcWorkingTime(0, 60, 0)); assertEquals(120, DateTimeUtils.calcWorkingTime(60, 180, 0)); assertEquals(120, DateTimeUtils.calcWorkingTime(60, 240, 60)); assertEquals(120, DateTimeUtils.calcWorkingTime(23 * 60, 60, 0)); assertEquals(240, DateTimeUtils.calcWorkingTime(23 * 60, 240, 60)); }
public static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration) { int workingTime = 0; if (leavingTime - commingTime >= 0) { workingTime += leavingTime - commingTime; } else { workingTime += (24 * 60 - commingTime) + leavingTime; } return workingTime - pauseDuration; }
DateTimeUtils { public static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration) { int workingTime = 0; if (leavingTime - commingTime >= 0) { workingTime += leavingTime - commingTime; } else { workingTime += (24 * 60 - commingTime) + leavingTime; } return workingTime - pauseDuration; } }
DateTimeUtils { public static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration) { int workingTime = 0; if (leavingTime - commingTime >= 0) { workingTime += leavingTime - commingTime; } else { workingTime += (24 * 60 - commingTime) + leavingTime; } return workingTime - pauseDuration; }  }
DateTimeUtils { public static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration) { int workingTime = 0; if (leavingTime - commingTime >= 0) { workingTime += leavingTime - commingTime; } else { workingTime += (24 * 60 - commingTime) + leavingTime; } return workingTime - pauseDuration; }  static String[] createYearsArray(int startingYear); static String[] createMonthArray(); static String[] createDayArray(); static String formatTime(int hour, int minute); static String formatTime(int time); static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration); }
DateTimeUtils { public static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration) { int workingTime = 0; if (leavingTime - commingTime >= 0) { workingTime += leavingTime - commingTime; } else { workingTime += (24 * 60 - commingTime) + leavingTime; } return workingTime - pauseDuration; }  static String[] createYearsArray(int startingYear); static String[] createMonthArray(); static String[] createDayArray(); static String formatTime(int hour, int minute); static String formatTime(int time); static int calcWorkingTime(int commingTime, int leavingTime, int pauseDuration);  }