summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
index 21a55a602b..a5df66e99c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RelativeDateFormatter.java
@@ -114,10 +114,11 @@ public class RelativeDateFormatter {
// up to 5 years use "year, months" rounded to months
if (ageMillis < 5 * YEAR_IN_MILLIS) {
- long years = ageMillis / YEAR_IN_MILLIS;
+ long years = round(ageMillis, MONTH_IN_MILLIS) / 12;
String yearLabel = (years > 1) ? JGitText.get().years : //
JGitText.get().year;
- long months = round(ageMillis % YEAR_IN_MILLIS, MONTH_IN_MILLIS);
+ long months = round(ageMillis - years * YEAR_IN_MILLIS,
+ MONTH_IN_MILLIS);
String monthLabel = (months > 1) ? JGitText.get().months : //
(months == 1 ? JGitText.get().month : ""); //$NON-NLS-1$
return MessageFormat.format(