Linus Torvalds <torvalds@xxxxxxxx> writes: > The exact cut-off points when it switches from days to weeks etc are > totally arbitrary, but are picked somewhat to avoid the "1 weeks ago" > thing (by making it show "10 days ago" rather than "1 week", or "70 > minutes ago" rather than "1 hour ago"). It might be arbitrary but I agree they make sense. The code was quite confusing in that after you turn it into days you stop converting to larger scale and I was going to nitpick that 365 weeks do not make much sense. I think you meant to do a "Turn it into weeks" conversion before comparing diff with 53 and then changed your mind, got confused yourself that diff is still in days and decided to say "months" for the past year. IOW, I think there is a bug around weeks/months code ;-). On top of your patch how about the attached? Personally I have mixed feeling about "months" scale. On one hand, I think it could extend to 30 months or so without losing readability when one is interested in "how long ago did this happen". On the other hand, it would take more time for me if I see "this happened 5 months ago" than "this happened in March this year" to recollect what the context of the particular change was ("ah I needed that feature when I was preparing the committer/author graph for OLS paper deadline"). P.S. welcome back to the list. diff --git a/date.c b/date.c index 92e3f6e..914fd82 100644 --- a/date.c +++ b/date.c @@ -87,17 +87,19 @@ const char *show_date(unsigned long time snprintf(timebuf, sizeof(timebuf), "%lu hours ago", diff); return timebuf; } - /* Turn it into days */ + /* Turn it into days; from here on we deal with days */ diff = (diff + 12) / 24; if (diff < 14) { snprintf(timebuf, sizeof(timebuf), "%lu days ago", diff); return timebuf; } - if (diff < 53) { + /* Say weeks for the past 6 months or so */ + if (diff < 180) { snprintf(timebuf, sizeof(timebuf), "%lu weeks ago", (diff + 3) / 7); return timebuf; } - if (diff < 365) { + /* Say months for the past 30 months or so */ + if (diff < 912) { snprintf(timebuf, sizeof(timebuf), "%lu months ago", (diff + 15) / 30); return timebuf; } - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html