Now make_ping_time() in common/util.c returns the time in milliseconds instead
of microseconds. In fe_set_lag(serv, lag) the lag argument is now in milliseconds as well. Fixes #758.
This commit is contained in:
parent
1d6d737927
commit
9969282c72
|
@ -118,7 +118,7 @@ void fe_set_nick (struct server *serv, char *newnick);
|
||||||
void fe_ignore_update (int level);
|
void fe_ignore_update (int level);
|
||||||
void fe_beep (session *sess);
|
void fe_beep (session *sess);
|
||||||
void fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gtk_xtext_search_flags flags);
|
void fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gtk_xtext_search_flags flags);
|
||||||
void fe_set_lag (server *serv, int lag);
|
void fe_set_lag (server *serv, long lag);
|
||||||
void fe_set_throttle (server *serv);
|
void fe_set_throttle (server *serv);
|
||||||
void fe_set_away (server *serv);
|
void fe_set_away (server *serv);
|
||||||
void fe_serverlist_open (session *sess);
|
void fe_serverlist_open (session *sess);
|
||||||
|
|
|
@ -892,8 +892,8 @@ inbound_ping_reply (session *sess, char *timestring, char *from,
|
||||||
if (lag)
|
if (lag)
|
||||||
{
|
{
|
||||||
sess->server->lag_sent = 0;
|
sess->server->lag_sent = 0;
|
||||||
sess->server->lag = dif / 1000;
|
sess->server->lag = dif;
|
||||||
fe_set_lag (sess->server, dif / 100000);
|
fe_set_lag (sess->server, dif);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ inbound_ping_reply (session *sess, char *timestring, char *from,
|
||||||
tags_data->timestamp);
|
tags_data->timestamp);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
snprintf (outbuf, sizeof (outbuf), "%ld.%ld%ld", dif / 1000000, (dif / 100000) % 10, dif % 10);
|
snprintf (outbuf, sizeof (outbuf), "%ld.%03ld", dif / 1000, dif % 1000);
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0,
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0,
|
||||||
tags_data->timestamp);
|
tags_data->timestamp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1459,7 +1459,7 @@ make_ping_time (void)
|
||||||
GTimeVal timev;
|
GTimeVal timev;
|
||||||
g_get_current_time (&timev);
|
g_get_current_time (&timev);
|
||||||
#endif
|
#endif
|
||||||
return (timev.tv_sec - 50000) * 1000000 + timev.tv_usec;
|
return (timev.tv_sec - 50000) * 1000 + timev.tv_usec/1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -713,7 +713,7 @@ fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gtk_xtext_search_f
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fe_set_lag (server *serv, int lag)
|
fe_set_lag (server *serv, long lag)
|
||||||
{
|
{
|
||||||
GSList *list = sess_list;
|
GSList *list = sess_list;
|
||||||
session *sess;
|
session *sess;
|
||||||
|
@ -727,21 +727,21 @@ fe_set_lag (server *serv, int lag)
|
||||||
if (!serv->lag_sent)
|
if (!serv->lag_sent)
|
||||||
return;
|
return;
|
||||||
nowtim = make_ping_time ();
|
nowtim = make_ping_time ();
|
||||||
lag = (nowtim - serv->lag_sent) / 100000;
|
lag = nowtim - serv->lag_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if there is no pong for >30s report the lag as +30s */
|
/* if there is no pong for >30s report the lag as +30s */
|
||||||
if (lag > 300 && serv->lag_sent)
|
if (lag > 30000 && serv->lag_sent)
|
||||||
lag=300;
|
lag=30000;
|
||||||
|
|
||||||
per = (double)((double)lag / (double)10);
|
per = ((double)lag) / 1000.0;
|
||||||
if (per > 1.0)
|
if (per > 1.0)
|
||||||
per = 1.0;
|
per = 1.0;
|
||||||
|
|
||||||
snprintf (lagtext, sizeof (lagtext) - 1, "%s%d.%ds",
|
snprintf (lagtext, sizeof (lagtext) - 1, "%s%ld.%lds",
|
||||||
serv->lag_sent ? "+" : "", lag / 10, lag % 10);
|
serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
|
||||||
snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%d.%d seconds",
|
snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%ld.%ld seconds",
|
||||||
serv->lag_sent ? "+" : "", lag / 10, lag % 10);
|
serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
|
||||||
|
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
|
|
|
@ -802,7 +802,7 @@ fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gtk_xtext_search_f
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
fe_set_lag (server * serv, int lag)
|
fe_set_lag (server * serv, long lag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue