提交 607a9e8a 编写于 作者: D David Reiss 提交者: Junio C Hamano

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: NDavid Reiss <dreiss@facebook.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e72263a1
......@@ -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",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册