1 diff -urN ppp.old/pppd/main.c ppp.dev/pppd/main.c
2 --- ppp.old/pppd/main.c 2005-11-11 19:19:28.177790000 +0100
3 +++ ppp.dev/pppd/main.c 2005-11-11 20:18:05.957363000 +0100
5 #include <sys/socket.h>
6 #include <netinet/in.h>
8 +#include <sys/sysinfo.h>
14 /* Prototypes for procedures local to this file. */
16 +static void check_time(void);
17 static void setup_signals __P((void));
18 static void create_pidfile __P((int pid));
19 static void create_linkpidfile __P((int pid));
21 info("Starting link");
25 gettimeofday(&start_time, NULL);
26 script_unsetenv("CONNECT_TIME");
27 script_unsetenv("BYTES_SENT");
28 @@ -1195,6 +1198,36 @@
30 static struct callout *callout = NULL; /* Callout list */
31 static struct timeval timenow; /* Current time */
32 +static long uptime_diff = 0;
33 +static int uptime_diff_set = 0;
35 +static void check_time(void)
42 + gettimeofday(&t, NULL);
44 + new_diff = t.tv_sec - i.uptime;
46 + if (!uptime_diff_set) {
47 + uptime_diff = new_diff;
48 + uptime_diff_set = 1;
52 + if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
53 + /* system time has changed, update counters and timeouts */
54 + info("System time change detected.");
55 + start_time.tv_sec += new_diff - uptime_diff;
57 + for (p = callout; p != NULL; p = p->c_next)
58 + p->c_time.tv_sec += new_diff - uptime_diff;
60 + uptime_diff = new_diff;
64 * timeout - Schedule a timeout.
71 while (callout != NULL) {
81 gettimeofday(&timenow, NULL);
82 tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;