提交 dbc1b1f7 编写于 作者: J Johan Sageryd 提交者: Jeff King

Fix '--relative-date'

This fixes '--relative-date' so that it does not give '0
year, 12 months', for the interval 360 <= diff < 365.
Signed-off-by: NJohan Sageryd <j416@1616.se>
Signed-off-by: NJeff King <peff@peff.net>
上级 b4ae5e2a
......@@ -123,7 +123,7 @@ const char *show_date_relative(unsigned long time, int tz,
return timebuf;
}
/* Say months for the past 12 months or so */
if (diff < 360) {
if (diff < 365) {
snprintf(timebuf, timebuf_size, "%lu months ago", (diff + 15) / 30);
return timebuf;
}
......
......@@ -24,6 +24,7 @@ check_show 13000000 '5 months ago'
check_show 37500000 '1 year, 2 months ago'
check_show 55188000 '1 year, 9 months ago'
check_show 630000000 '20 years ago'
check_show 31449600 '12 months ago'
check_parse() {
echo "$1 -> $2" >expect
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册