diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-29 11:43:18 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-29 11:43:18 -0700 |
commit | 04a67dc622b298226628fe344af835a7191dc1aa (patch) | |
tree | 4b0c675e0ce135634202dfb9374fef01fd414d1e /date.c | |
parent | a1dd7e16ad6df793fc393d6df8e9082261a0ce42 (diff) | |
parent | f1e9c548ce45005521892af0299696204ece286b (diff) | |
download | git-04a67dc622b298226628fe344af835a7191dc1aa.tar.gz |
Merge branch 'mg/x-years-12-months' into maint
* mg/x-years-12-months:
date: avoid "X years, 12 months" in relative dates
Diffstat (limited to 'date.c')
-rw-r--r-- | date.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -129,8 +129,9 @@ const char *show_date_relative(unsigned long time, int tz, } /* Give years and months for 5 years or so */ if (diff < 1825) { - unsigned long years = diff / 365; - unsigned long months = (diff % 365 + 15) / 30; + unsigned long totalmonths = (diff * 12 * 2 + 365) / (365 * 2); + unsigned long years = totalmonths / 12; + unsigned long months = totalmonths % 12; int n; n = snprintf(timebuf, timebuf_size, "%lu year%s", years, (years > 1 ? "s" : "")); |