[PATCH] timer for modemlights w/ ISDN



Hi,

I just got ISDN set up and realized that there is no timer running if you
run modemlights w/ ISDN. I quickly came up with the attached patch (it's
against gnome-core-1.0.54) which may give a bit inaccurate timing (only
with ISDN, it begins to count when modemlights realizes the connection so
it might skip one or two seconds).

I didn't find this in the bug tracker, and if this gets into CVS and the
next release, it probably won't ever :-).

Nils
-- 
 Nils Philippsen / Berliner Straße 39 / D-71229 Leonberg // +49.7152.209647
nils@wombat.dialup.fht-esslingen.de / nils@fht-esslingen.de / nils@redhat.de
   The use of COBOL cripples the mind; its teaching should, therefore, be
   regarded as a criminal offence.                  -- Edsger W. Dijkstra
--- gnome-core-1.0.54/applets/modemlights/modemlights.c.isdntimer	Sun Sep 19 06:02:15 1999
+++ gnome-core-1.0.54/applets/modemlights/modemlights.c	Mon Dec  6 17:22:24 1999
@@ -361,8 +361,18 @@
 
 static gint get_ISDN_connect_time(gint recalc_start)
 {
-	/* Fixme! not implemented for ISDN */
-	return 0;
+	/* this is a bad hack just to get some (not very accurate) timing */
+	static time_t start_time = (time_t)0;
+
+	if (recalc_start)
+		{
+		start_time = time(0);
+		}
+
+	if (start_time != (time_t)0)
+		return (gint)(time(0) - start_time);
+	else
+		return -1;
 }
 
 static gint get_modem_connect_time(gint recalc_start)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]