Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder13 years agocommitted byJunio C Hamano
Q_("%lu year ago", "%lu years ago", years), years);
return;
}
/* Otherwise, just years. Centuries is probably overkill. */
snprintf(timebuf, timebuf_size, "%lu years ago", (diff + 183) / 365);
return timebuf;
strbuf_addf(timebuf,
Q_("%lu year ago", "%lu years ago", (diff + 183) / 365),
(diff + 183) / 365);
}
const char *show_date(unsigned long time, int tz, enum date_mode mode)
{
struct tm *tm;
static char timebuf[200];
static struct strbuf timebuf = STRBUF_INIT;
if (mode == DATE_RAW) {
snprintf(timebuf, sizeof(timebuf), "%lu %+05d", time, tz);
return timebuf;
strbuf_reset(&timebuf);
strbuf_addf(&timebuf, "%lu %+05d", time, tz);
return timebuf.buf;
}
if (mode == DATE_RELATIVE) {
struct timeval now;
strbuf_reset(&timebuf);
gettimeofday(&now, NULL);
return show_date_relative(time, tz, &now,
timebuf, sizeof(timebuf));
show_date_relative(time, tz, &now, &timebuf);
return timebuf.buf;
}
if (mode == DATE_LOCAL)
@ -171,23 +186,25 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
@@ -171,23 +186,25 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
@ -195,7 +212,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
@@ -195,7 +212,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)