summary refs log tree commit diff stats
path: root/src/fe-gtk/fe-gtk.c
diff options
context:
space:
mode:
authorTingPing <TingPing@users.noreply.github.com>2014-02-04 17:29:27 -0800
committerTingPing <TingPing@users.noreply.github.com>2014-02-04 17:29:27 -0800
commit29e01daeae94281d5c21aba01dae9123f6aa34d5 (patch)
tree9660121007954778aa804a78206c5b4b8445b33e /src/fe-gtk/fe-gtk.c
parent9f01950bcbc85f8b3960724b6df77c3e9c111601 (diff)
parent9969282c72f838004fe3d75f06db48072b0fbfeb (diff)
Merge pull request #890 from orium/lagmeter-fixes
Lagmeter fixes
Diffstat (limited to 'src/fe-gtk/fe-gtk.c')
-rw-r--r--src/fe-gtk/fe-gtk.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index 389ef899..ae68bb79 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -713,7 +713,7 @@ fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gtk_xtext_search_f
 }
 
 void
-fe_set_lag (server *serv, int lag)
+fe_set_lag (server *serv, long lag)
 {
 	GSList *list = sess_list;
 	session *sess;
@@ -727,21 +727,21 @@ fe_set_lag (server *serv, int lag)
 		if (!serv->lag_sent)
 			return;
 		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 (lag > 300 && serv->lag_sent)
-		lag=300;
+	if (lag > 30000 && serv->lag_sent)
+		lag=30000;
 
-	per = (double)((double)lag / (double)10);
+	per = ((double)lag) / 1000.0;
 	if (per > 1.0)
 		per = 1.0;
 
-	snprintf (lagtext, sizeof (lagtext) - 1, "%s%d.%ds",
-				 serv->lag_sent ? "+" : "", lag / 10, lag % 10);
-	snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%d.%d seconds",
-				 serv->lag_sent ? "+" : "", lag / 10, lag % 10);
+	snprintf (lagtext, sizeof (lagtext) - 1, "%s%ld.%lds",
+			  serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
+	snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%ld.%ld seconds",
+				 serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
 
 	while (list)
 	{