diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-09-26 11:20:42 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-09-26 11:20:42 -0700 |
commit | d9f9e10e7b3ad61342ec1d9b034dd17f8452ccbc (patch) | |
tree | 3a0b155a8b2273cfe41110fe0a15ce50d6eb1e4f /sys/src/cmd/upas/scanmail/scanmail.c | |
parent | 9afa5550f7497f84fb157ba07ff94301dbe06bcc (diff) |
upas: convert to tmdate, change timezone format
Complete the conversion of upas to remove ctime,
use the new date library, and print time zones
in +hhmm format, instead of NNN format.
This may affect code that expects specific names
for timezones. Fix that code.
Diffstat (limited to 'sys/src/cmd/upas/scanmail/scanmail.c')
-rw-r--r-- | sys/src/cmd/upas/scanmail/scanmail.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/src/cmd/upas/scanmail/scanmail.c b/sys/src/cmd/upas/scanmail/scanmail.c index c84c0fa5d..9654af43f 100644 --- a/sys/src/cmd/upas/scanmail/scanmail.c +++ b/sys/src/cmd/upas/scanmail/scanmail.c @@ -400,18 +400,16 @@ Biobuf* opendump(char *sender) { int i; + Tm tm; ulong h; char buf[512]; Biobuf *b; - char *cp; + char *cp, mon[8], day[4]; - cp = ctime(time(0)); - cp[7] = 0; - cp[10] = 0; - if(cp[8] == ' ') - snprint(buf, sizeof buf, "%s/queue.dump/%s%c", SPOOL, cp+4, cp[9]); - else - snprint(buf, sizeof buf, "%s/queue.dump/%s%c%c", SPOOL, cp+4, cp[8], cp[9]); + tmnow(&tm, nil); + snprint(mon, sizeof(mon), "%τ", tmfmt(&tm, "MMM")); + snprint(day, sizeof(day), "%τ", tmfmt(&tm, "D")); + snprint(buf, sizeof buf, "%s/queue.dump/%s%s", SPOOL, mon, day); cp = buf+strlen(buf); if(access(buf, 0) < 0 && sysmkdir(buf, 0777) < 0){ syslog(0, "smtpd", "couldn't dump mail from %s: %r", sender); |