Format WHOIS signon date with %F %T

weechat-hashes
C. McEnroe 2020-02-19 21:29:51 -05:00
parent d5c4e7e371
commit 2a33ee68dd
1 changed files with 6 additions and 4 deletions

View File

@ -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( uiFormat(
Network, Warm, tagTime(msg), 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], completeColor(Network, msg->params[1]), msg->params[1],
idle, unit, (idle != 1 ? "s" : ""), idle, unit, (idle != 1 ? "s" : ""),
(signon ? ", signed on " : ""), (msg->params[3] ? ", signed on " : ""),
24, (signon ? ctime(&signon) : "") (msg->params[3] ? signon : "")
); );
} }