Package org.eclipse.jgit.util
Class RelativeDateFormatter
- java.lang.Object
-
- org.eclipse.jgit.util.RelativeDateFormatter
-
public class RelativeDateFormatter extends java.lang.ObjectFormatter to format timestamps relative to the current time using time units in the format defined bygit log --relative-date.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static longDAY_IN_MILLIS(package private) static longHOUR_IN_MILLIS(package private) static longMINUTE_IN_MILLIS(package private) static longMONTH_IN_MILLIS(package private) static longSECOND_IN_MILLIS(package private) static longWEEK_IN_MILLIS(package private) static longYEAR_IN_MILLIS
-
Constructor Summary
Constructors Constructor Description RelativeDateFormatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringformat(java.util.Date when)Get age of givenDatecompared to now formatted in the same relative format as returned bygit log --relative-dateprivate static longround(long n, long unit)private static longupperLimit(long unit)
-
-
-
Field Detail
-
SECOND_IN_MILLIS
static final long SECOND_IN_MILLIS
- See Also:
- Constant Field Values
-
MINUTE_IN_MILLIS
static final long MINUTE_IN_MILLIS
- See Also:
- Constant Field Values
-
HOUR_IN_MILLIS
static final long HOUR_IN_MILLIS
- See Also:
- Constant Field Values
-
DAY_IN_MILLIS
static final long DAY_IN_MILLIS
- See Also:
- Constant Field Values
-
WEEK_IN_MILLIS
static final long WEEK_IN_MILLIS
- See Also:
- Constant Field Values
-
MONTH_IN_MILLIS
static final long MONTH_IN_MILLIS
- See Also:
- Constant Field Values
-
YEAR_IN_MILLIS
static final long YEAR_IN_MILLIS
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
public static java.lang.String format(java.util.Date when)
Get age of givenDatecompared to now formatted in the same relative format as returned bygit log --relative-date- Parameters:
when-Dateto format- Returns:
- age of given
Datecompared to now formatted in the same relative format as returned bygit log --relative-date
-
upperLimit
private static long upperLimit(long unit)
-
round
private static long round(long n, long unit)
-
-