From 8ffb8b238dfd3614afc582c0d5537e684219d039 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 6 Jun 2009 17:41:51 +0200 Subject: [PATCH] Bugfix: $addr and $addrs couldn't find ip's before the first update. When you started "$updates|${addr eth0}" displayed "0|No Address", after the first update you got something normal like "1|192.168.0.1" This patch should fix this. --- src/conky.c | 1 - src/conky.h | 2 ++ src/freebsd.c | 2 +- src/linux.c | 2 +- src/netbsd.c | 2 +- src/openbsd.c | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/conky.c b/src/conky.c index 5a8738a2..14c70ca3 100644 --- a/src/conky.c +++ b/src/conky.c @@ -405,7 +405,6 @@ static int pad_percents = 0; static char *global_text = 0; long global_text_lines; -static int total_updates; static int updatereset; int check_contains(char *f, char *s) diff --git a/src/conky.h b/src/conky.h index 78f30d6f..63615f2e 100644 --- a/src/conky.h +++ b/src/conky.h @@ -332,6 +332,8 @@ enum x_initialiser_state { extern int output_methods; extern enum x_initialiser_state x_initialised; +int total_updates; + #define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE" #endif /* _conky_h_ */ diff --git a/src/freebsd.c b/src/freebsd.c index 20c4e27b..fcdcfce3 100644 --- a/src/freebsd.c +++ b/src/freebsd.c @@ -187,7 +187,7 @@ void update_net_stats() /* get delta */ delta = current_update_time - last_update_time; - if (delta <= 0.0001) { + if (delta <= 0.0001 && total_updates != 0) { return; } diff --git a/src/linux.c b/src/linux.c index 74fceb35..c94caec2 100644 --- a/src/linux.c +++ b/src/linux.c @@ -310,7 +310,7 @@ void update_net_stats(void) /* get delta */ delta = current_update_time - last_update_time; - if (delta <= 0.0001) { + if (delta <= 0.0001 && total_updates != 0) { return; } diff --git a/src/netbsd.c b/src/netbsd.c index 63023d58..58f111d3 100644 --- a/src/netbsd.c +++ b/src/netbsd.c @@ -173,7 +173,7 @@ void update_net_stats() /* get delta */ delta = current_update_time - last_update_time; - if (delta <= 0.0001) { + if (delta <= 0.0001 && total_updates != 0) { return; } diff --git a/src/openbsd.c b/src/openbsd.c index 5a1d3213..599f2528 100644 --- a/src/openbsd.c +++ b/src/openbsd.c @@ -200,7 +200,7 @@ void update_net_stats() /* get delta */ delta = current_update_time - last_update_time; - if (delta <= 0.0001) { + if (delta <= 0.0001 && total_updates != 0) { return; }