|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.utils.TimeUtils
public final class TimeUtils
This class provides a set of utilities for time measurement and comparison.
Constructor Summary | |
---|---|
TimeUtils()
|
Method Summary | |
---|---|
static void |
changeByDays(java.util.Calendar calendar,
int days)
Changes calendar date by the specified days amount. |
static java.util.Date |
currentDate()
Returns current system date. |
static long |
currentNanoTime()
Returns current system nano time. |
static long |
currentTime()
Returns current system time. |
static void |
decreaseByDay(java.util.Calendar calendar)
Decreases calendar date by one day. |
static java.util.Date |
getEndOfDay(java.util.Date date)
Returns end-of-day date. |
static java.lang.Long |
getLastNanoTime()
Returns either last pinned nanotime or last request nanotime. |
static java.lang.Long |
getLastTime()
Returns either last pinned time or last request time. |
static long |
getPassedNanoTime()
Returns nanotime passed since either last pin request or last nanotime request. |
static long |
getPassedNanoTime(boolean total)
Returns nanotime passed since either last pin request or last nanotime request if total is false. |
static long |
getPassedTime()
Returns time passed since either last pin request or last time request. |
static long |
getPassedTime(boolean total)
Returns time passed since either last pin request or last time request if total is false. |
static java.lang.Long |
getPinnedNanoTime()
Returns last pinned nanotime. |
static java.lang.Long |
getPinnedTime()
Returns last pinned time. |
static java.util.Date |
getStartOfDay(java.util.Date date)
Returns start-of-day date. |
static void |
increaseByDay(java.util.Calendar calendar)
Increases calendar date by one day. |
static boolean |
isSameDay(java.util.Calendar calendar,
java.util.Date date)
Returns true if date contained in Calendar and specified date both represent the same day. |
static boolean |
isSameDay(java.util.Calendar calendar,
java.lang.Long date)
Returns true if date contained in Calendar and specified time both represent the same day. |
static boolean |
isSameDay(java.util.Date date1,
java.util.Date date2)
Returns true if both of the dates represent the same day. |
static boolean |
isSameDay(java.lang.Long time1,
java.lang.Long time2)
Returns true if both of the time represent the same day. |
static void |
pinNanoTime()
Pins current system nanotime. |
static void |
pinTime()
Pins current system time. |
static void |
resetNanoTime()
Resets last pinned nanotime and last request nanotime. |
static void |
resetTime()
Resets last pinned time and last request time. |
static void |
showPassedNanoTime()
Writes nanotime passed since either last pin request or last nanotime request to log. |
static void |
showPassedNanoTime(boolean total)
Writes nanotime passed since either last pin request or last nanotime request if total is false to log. |
static void |
showPassedNanoTime(boolean total,
java.lang.String prefix)
Writes nanotime passed since either last pin request or last nanotime request if total is false to log with specified prefix. |
static void |
showPassedNanoTime(java.lang.String prefix)
Writes nanotime passed since either last pin request or last nanotime request to log with specified prefix. |
static void |
showPassedTime()
Writes time passed since either last pin request or last time request to log. |
static void |
showPassedTime(boolean total)
Writes time passed since either last pin request or last time request if total is false to log. |
static void |
showPassedTime(boolean total,
java.lang.String prefix)
Writes time passed since either last pin request or last time request if total is false to log with specified prefix. |
static void |
showPassedTime(java.lang.String prefix)
Writes time passed since either last pin request or last time request to log with specified prefix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeUtils()
Method Detail |
---|
public static java.lang.Long getPinnedTime()
public static java.lang.Long getLastTime()
public static void pinTime()
public static long getPassedTime()
public static long getPassedTime(boolean total)
total
- should always return time passed since last pin request or not
public static void showPassedTime()
public static void showPassedTime(java.lang.String prefix)
prefix
- output string prefixpublic static void showPassedTime(boolean total)
total
- should always write time passed since last pin request or notpublic static void showPassedTime(boolean total, java.lang.String prefix)
total
- should always write time passed since last pin request or notprefix
- output string prefixpublic static void resetTime()
public static java.lang.Long getPinnedNanoTime()
public static java.lang.Long getLastNanoTime()
public static void pinNanoTime()
public static long getPassedNanoTime()
public static long getPassedNanoTime(boolean total)
total
- should always return time passed since last pin request or not
public static void showPassedNanoTime()
public static void showPassedNanoTime(java.lang.String prefix)
prefix
- output string prefixpublic static void showPassedNanoTime(boolean total)
total
- should always write nanotime passed since last pin request or notpublic static void showPassedNanoTime(boolean total, java.lang.String prefix)
total
- should always write nanotime passed since last pin request or notprefix
- output string prefixpublic static void resetNanoTime()
public static long currentTime()
public static long currentNanoTime()
public static java.util.Date currentDate()
public static boolean isSameDay(java.util.Date date1, java.util.Date date2)
date1
- first datedate2
- second date
public static boolean isSameDay(java.lang.Long time1, java.lang.Long time2)
time1
- first timetime2
- second time
public static boolean isSameDay(java.util.Calendar calendar, java.util.Date date)
calendar
- calendardate
- date
public static boolean isSameDay(java.util.Calendar calendar, java.lang.Long date)
calendar
- calendardate
- date
public static java.util.Date getStartOfDay(java.util.Date date)
date
- date to process
public static java.util.Date getEndOfDay(java.util.Date date)
date
- date to process
public static void increaseByDay(java.util.Calendar calendar)
calendar
- calendar that should be changedpublic static void decreaseByDay(java.util.Calendar calendar)
calendar
- calendar that should be changedpublic static void changeByDays(java.util.Calendar calendar, int days)
calendar
- calendar that should be changeddays
- days amount
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |