Fix whois idle unit calculation

Rookie mistake.
master
C. McEnroe 2020-02-11 04:00:25 -05:00
parent 86fac7caad
commit ac4876718f
1 changed files with 9 additions and 3 deletions

View File

@ -407,9 +407,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
if (!replies.whois) return; if (!replies.whois) return;
unsigned long idle = strtoul(msg->params[2], NULL, 10); unsigned long idle = strtoul(msg->params[2], NULL, 10);
const char *unit = "second"; const char *unit = "second";
if (idle / 60) { idle /= 60; unit = "minute"; } if (idle / 60) {
if (idle / 60) { idle /= 60; unit = "hour"; } idle /= 60; unit = "minute";
if (idle / 24) { idle /= 24; unit = "day"; } if (idle / 60) {
idle /= 60; unit = "hour";
if (idle / 24) {
idle /= 24; unit = "day";
}
}
}
time_t signon = (msg->params[3] ? strtoul(msg->params[3], NULL, 10) : 0); time_t signon = (msg->params[3] ? strtoul(msg->params[3], NULL, 10) : 0);
uiFormat( uiFormat(
Network, Warm, tagTime(msg), Network, Warm, tagTime(msg),