@matheusbsbs / matheus-bagliano / commits / 607a9e8aaa
Fork 0

Round-down years in "years+months" relative date view

Previously, a commit from 1 year and 7 months ago would display as "2 years, 7 months ago". Signed-off-by: David Reiss <dreiss@facebook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Reiss committed Aug 27, 2009 at 16:39 UTC 607a9e8aaa9b1a18f81ae67e40a5c8a5d1a92577
1 file changed +1 -1
date.c
+1 -1
@@ -135,7 +135,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
135 }
136 /* Give years and months for 5 years or so */
137 if (diff < 1825) {
138 - unsigned long years = (diff + 183) / 365;
138 + unsigned long years = diff / 365;
139 unsigned long months = (diff % 365 + 15) / 30;
140 int n;
141 n = snprintf(timebuf, sizeof(timebuf), "%lu year%s",