@Test // 1000000 times: 627 mills. // 1000000 times: 628 mills. // 1000000 times: 631 mills. public void begTimeOfDate() { Calendar calendar = CalendarHelper.today(); Calendar begTime = null; Calendar endTime = null; int count = 1000000; // 100w long beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { begTime = CalendarHelper.begTimeOfDate(calendar); } // long end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); // System.out.println(CalendarHelper.toString(begTime)); beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { endTime = CalendarHelper.endTimeOfDate(calendar); } // end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); System.out.println(CalendarHelper.toString(endTime)); }
@Test public void today() { Calendar value = null; int count = 1000000; // 100w long beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { value = CalendarHelper.today(); } // long end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); System.out.println(CalendarHelper.toString(value)); System.out.println(CalendarHelper.toString(value, DateHelper.DATE_TIME_MILLS_PATTERN)); }
@Test // 1000000 times: 2512 mills. // 1000000 times: 2789 mills. // 1000000 times: 2792 mills. public void toCalendar() { Calendar value = null; int count = 1000000; // 100w long beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { value = CalendarHelper.toCalendar("2012/03/02 13:42:17:534", DateHelper.DATE_TIME_MILLS_PATTERN); } // long end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); System.out.println(CalendarHelper.toString(value)); System.out.println(CalendarHelper.toString(value, DateHelper.DATE_TIME_MILLS_PATTERN)); }
@Test // 1000000 times: 1760 mills. // 1000000 times: 1722 mills. // 1000000 times: 1763 mills. public void toStringz() { Calendar today = CalendarHelper.today(); String value = null; int count = 1000000; // 100w long beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { // 2012/02/09 09:57:23:671 // 2012/02/09 21:57:49:908 value = CalendarHelper.toString(today, DateHelper.DATE_TIME_MILLS_PATTERN); } // long end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); System.out.println(value); }