[BusyBox-cvs] svn commit: trunk/busybox/networking/udhcp

landley at busybox.net landley at busybox.net
Wed May 4 02:15:24 UTC 2005


Author: landley
Date: 2005-05-03 20:15:23 -0600 (Tue, 03 May 2005)
New Revision: 10247

Log:
Revert the uptime() removal.  Let the list sort it out...



Modified:
   trunk/busybox/networking/udhcp/arpping.c
   trunk/busybox/networking/udhcp/common.c
   trunk/busybox/networking/udhcp/common.h
   trunk/busybox/networking/udhcp/dhcpc.c


Changeset:
Modified: trunk/busybox/networking/udhcp/arpping.c
===================================================================
--- trunk/busybox/networking/udhcp/arpping.c	2005-05-04 01:00:23 UTC (rev 10246)
+++ trunk/busybox/networking/udhcp/arpping.c	2005-05-04 02:15:23 UTC (rev 10247)
@@ -79,7 +79,7 @@
 
 	/* wait arp reply, and check it */
 	tm.tv_usec = 0;
-	prevTime = time(NULL);
+	prevTime = uptime();
 	while (timeout > 0) {
 		FD_ZERO(&fdset);
 		FD_SET(s, &fdset);
@@ -97,8 +97,8 @@
 				break;
 			}
 		}
-		timeout -= time(NULL) - prevTime;
-		prevTime = time(NULL);
+		timeout -= uptime() - prevTime;
+		prevTime = uptime();
 	}
 	close(s);
 	DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");	

Modified: trunk/busybox/networking/udhcp/common.c
===================================================================
--- trunk/busybox/networking/udhcp/common.c	2005-05-04 01:00:23 UTC (rev 10246)
+++ trunk/busybox/networking/udhcp/common.c	2005-05-04 02:15:23 UTC (rev 10247)
@@ -37,6 +37,14 @@
 
 static int daemonized;
 
+long uptime(void)
+{
+	struct sysinfo info;
+	sysinfo(&info);
+	return info.uptime;
+}
+
+
 /*
  * This function makes sure our first socket calls
  * aren't going to fd 1 (printf badness...) and are

Modified: trunk/busybox/networking/udhcp/common.h
===================================================================
--- trunk/busybox/networking/udhcp/common.h	2005-05-04 01:00:23 UTC (rev 10246)
+++ trunk/busybox/networking/udhcp/common.h	2005-05-04 02:15:23 UTC (rev 10247)
@@ -39,6 +39,7 @@
 #include <syslog.h>
 #endif
 
+long uptime(void);
 void background(const char *pidfile);
 void start_log_and_pid(const char *client_server, const char *pidfile);
 void background(const char *pidfile);

Modified: trunk/busybox/networking/udhcp/dhcpc.c
===================================================================
--- trunk/busybox/networking/udhcp/dhcpc.c	2005-05-04 01:00:23 UTC (rev 10246)
+++ trunk/busybox/networking/udhcp/dhcpc.c	2005-05-04 02:15:23 UTC (rev 10247)
@@ -310,7 +310,7 @@
 
 	for (;;) {
 
-		tv.tv_sec = timeout - time(NULL);
+		tv.tv_sec = timeout - uptime();
 		tv.tv_usec = 0;
 
 		if (listen_mode != LISTEN_NONE && fd < 0) {
@@ -330,7 +330,7 @@
 			retval = select(max_fd + 1, &rfds, NULL, NULL, &tv);
 		} else retval = 0; /* If we already timed out, fall through */
 
-		now = time(NULL);
+		now = uptime();
 		if (retval == 0) {
 			/* timeout dropped to zero */
 			switch (state) {




More information about the busybox-cvs mailing list