From 2a33ee68dd6dc201eb37828f109f02371daa1e80 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Wed, 19 Feb 2020 21:29:51 -0500 Subject: Format WHOIS signon date with %F %T --- handle.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index cec823a..fd8b25f 100644 --- a/handle.c +++ b/handle.c @@ -498,14 +498,16 @@ static void handleReplyWhoisIdle(struct Message *msg) { } } } - time_t signon = (msg->params[3] ? strtoul(msg->params[3], NULL, 10) : 0); + char signon[sizeof("0000-00-00 00:00:00")]; + time_t time = (msg->params[3] ? strtol(msg->params[3], NULL, 10) : 0); + strftime(signon, sizeof(signon), "%F %T", localtime(&time)); uiFormat( Network, Warm, tagTime(msg), - "\3%02d%s\3\tis idle for %lu %s%s%s%.*s", + "\3%02d%s\3\tis idle for %lu %s%s%s%s", completeColor(Network, msg->params[1]), msg->params[1], idle, unit, (idle != 1 ? "s" : ""), - (signon ? ", signed on " : ""), - 24, (signon ? ctime(&signon) : "") + (msg->params[3] ? ", signed on " : ""), + (msg->params[3] ? signon : "") ); } -- cgit 1.4.1-2-gfad0