time_t current_time, enum ls_listing_mode lm)
{
struct tm t;
+ /*
+ * Omit year but show time if the given value is closer to the current
+ * time than this many seconds.
+ */
+ const time_t m = 6 * 30 * 24 * 3600; /* six months */
if (!localtime_r((time_t *)seconds, &t))
return -E_LOCALTIME;
return -E_STRFTIME;
return 1;
}
- if (*seconds + 6 * 30 * 24 * 3600 > current_time) {
+ if (*seconds > current_time - m && *seconds < current_time + m) {
if (!strftime(buf, size, "%b %e %k:%M", &t))
return -E_STRFTIME;
return 1;
}
- if (!strftime(buf, size, "%b %e %Y", &t))
+ if (!strftime(buf, size, "%b %e %Y", &t))
return -E_STRFTIME;
return 1;
}