mscan: use %H:%M timestamp for all mails newer than 24h

pull/37/head
Leah Neukirchen 7 years ago
parent 4f99861f09
commit 3732dd355d

@ -29,7 +29,7 @@ static int alias_idx;
static int Iflag; static int Iflag;
static int nflag; static int nflag;
static int curyear; static int curyear;
static int curyday; static time_t now;
static char default_fflag[] = "%c%u%r %-3n %10d %17f %t %2i%s"; static char default_fflag[] = "%c%u%r %-3n %10d %17f %t %2i%s";
static char *fflag = default_fflag; static char *fflag = default_fflag;
@ -137,14 +137,14 @@ fmt_date(struct message *msg, int w, int iso)
} else if (w < 10) { } else if (w < 10) {
if (tm->tm_year != curyear) if (tm->tm_year != curyear)
strftime(date, sizeof date, "%b%y", tm); strftime(date, sizeof date, "%b%y", tm);
else if (tm->tm_yday != curyday) else if (t > now || now - t > 86400)
strftime(date, sizeof date, "%d%b", tm); strftime(date, sizeof date, "%d%b", tm);
else else
strftime(date, sizeof date, "%H:%M", tm); strftime(date, sizeof date, "%H:%M", tm);
} else { } else {
if (tm->tm_year != curyear) if (tm->tm_year != curyear)
strftime(date, sizeof date, "%Y-%m-%d", tm); strftime(date, sizeof date, "%Y-%m-%d", tm);
else if (tm->tm_yday != curyday) else if (t > now || now - t > 86400)
strftime(date, sizeof date, "%a %b %e", tm); strftime(date, sizeof date, "%a %b %e", tm);
else else
strftime(date, sizeof date, "%a %H:%M", tm); strftime(date, sizeof date, "%a %H:%M", tm);
@ -507,10 +507,9 @@ main(int argc, char *argv[])
return 0; return 0;
} }
time_t now = time(0); now = time(0);
struct tm *tm = localtime(&now); struct tm *tm = localtime(&now);
curyear = tm->tm_year; curyear = tm->tm_year;
curyday = tm->tm_yday;
setlocale(LC_ALL, ""); // for wcwidth later setlocale(LC_ALL, ""); // for wcwidth later
if (wcwidth(0xfffd) > 0) if (wcwidth(0xfffd) > 0)

Loading…
Cancel
Save