diff --git a/src/irc.c b/src/irc.c index afc4641..4762751 100644 --- a/src/irc.c +++ b/src/irc.c @@ -188,8 +188,13 @@ void irc_start_lagtest(struct link_server *l) */ void irc_compute_lag(struct link_server *is) { + time_t lag; assert(is->laginit_ts != -1); - is->lag = time(NULL) - is->laginit_ts; + lag = time(NULL) - is->laginit_ts; + if (lag > LAGOUT_TIME*2) + is->lag = LAGOUT_TIME*2; + else + is->lag = (unsigned)lag; } int irc_lags_out(struct link_server *is) diff --git a/src/irc.h b/src/irc.h index f3fc68b..e29ac77 100644 --- a/src/irc.h +++ b/src/irc.h @@ -239,8 +239,8 @@ struct link_server { size_t user_mode_len; /* init stuff */ - int lag; - int laginit_ts; + unsigned lag; + time_t laginit_ts; int lagtest_timeout; /* chanmodes */