cio

a simple irc client
git clone git://kloet.net/cio
Download | Log | Files | Refs | README | LICENSE

commit 36ee8efc9b4c8dec476ec768d591b232cef4accc
parent 71a40a716ea8113bc0e337e9e146b0c64831e51e
Author: Andrew Kloet <andrew@kloet.net>
Date:   Sat,  2 May 2026 10:59:22 -0400

pushf: build date string with strftime

Diffstat:
Mcio.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/cio.c b/cio.c @@ -406,10 +406,9 @@ pushf(int cn, const char *fmt, ...) n += (wrote < 0) ? 0 : wrote; /* failed to append to buffer */ va_end(vl); if (logfp) { - fprintf(logfp, "%-12.12s\t%04d-%02d-%02dT%02d:%02d:%02dZ\t%s\n", - c->name, - gmtm.tm_year + 1900, gmtm.tm_mon + 1, gmtm.tm_mday, - gmtm.tm_hour, gmtm.tm_min, gmtm.tm_sec, s); + char isodate[32]; + strftime(isodate, sizeof(isodate), "%Y-%m-%dT%H:%M:%SZ", &gmtm); + fprintf(logfp, "%-12.12s\t%s\t%s\n", c->name, isodate, s); fflush(logfp); } c->eol += n;