// 314 RPL_WHOWASUSER
void rpl_whoisidle(Client *client, Client *cl) // 317
{
- // FIXME: 64-bit time_t support
- copy_strf(&databuf, ":%s 317 %s %s %u %u :seconds idle, signon time\r\n",
- hostname, client->nick, cl->nick, (unsigned)(get_time()-cl->lastactivity), (unsigned)cl->signon);
+ copy_strf(&databuf, ":%s 317 %s %s %lu %lu :seconds idle, signon time\r\n",
+ hostname, client->nick, cl->nick, (unsigned long)(get_time()-cl->lastactivity), (unsigned long)cl->signon);
}
void rpl_endofwhois(Client *client, Client *cl) // 318
{
}
void rpl_creationtime(Client *client, Channel *chan) // 329
{
- // FIXME: 64-bit time_t support
- copy_strf(&databuf, ":%s 329 %s %s %u\r\n", hostname, client->nick, chan->name, (unsigned)chan->creation);
+ copy_strf(&databuf, ":%s 329 %s %s %lu\r\n", hostname, client->nick, chan->name, (unsigned long)chan->creation);
}
void rpl_whoisaccount(Client *client, Client *cl) // 330
{
}
void rpl_topicwhotime(Client *client, Channel *chan) // 333
{
- // FIXME: 64-bit time_t support
- copy_strf(&databuf, ":%s 333 %s %s %s %u\r\n", hostname, client->nick,
- chan->name, chan->topic_who, (unsigned)chan->topic_when);
+ copy_strf(&databuf, ":%s 333 %s %s %s %lu\r\n", hostname, client->nick,
+ chan->name, chan->topic_who, (unsigned long)chan->topic_when);
}
void rpl_whoisbot(Client *client, Client *cl) // 335
{
// 382 RPL_REHASHING
void rpl_time(Client *client, time_t ts) // 391
{
- // FIXME: 64-bit time_t support
char buf[26];
memcpy(buf, ctime(&ts), 26);
buf[24] = '\0';
char c = static_cast<char>(va_arg(ap, int));
append_strn(v, &c, 1);
s = end + 2;
+ } else if (end[1] == 'l' && end[2] == 'u') { // %lu
+ append_strn(v, s, end-s);
+ unsigned long c = va_arg(ap, unsigned long);
+ char buf[21] = {0};
+ auto res = std::to_chars(std::begin(buf), std::end(buf), c);
+ if (res.ec == std::errc())
+ append_strn(v, buf, res.ptr-buf);
+ s = end + 3;
} else if (end[1] == 'u') { // %u
append_strn(v, s, end-s);
unsigned c = va_arg(ap, unsigned);