Skip to content

Commit

Permalink
Round-down years in "years+months" relative date view
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Reiss authored and Junio C Hamano committed Aug 28, 2009
1 parent e72263a commit 607a9e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion date.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
}
/* Give years and months for 5 years or so */
if (diff < 1825) {
unsigned long years = (diff + 183) / 365;
unsigned long years = diff / 365;
unsigned long months = (diff % 365 + 15) / 30;
int n;
n = snprintf(timebuf, sizeof(timebuf), "%lu year%s",
Expand Down

0 comments on commit 607a9e8

Please sign in to comment.