Don't do useless checks
authorNikolas Garofil <garo@dunaldi.garofil.be>
Fri, 24 Jul 2009 10:39:48 +0000 (12:39 +0200)
committerNikolas Garofil <garo@dunaldi.garofil.be>
Fri, 24 Jul 2009 10:39:48 +0000 (12:39 +0200)
src/conky.c

index e2cc74b..3f732b3 100644 (file)
@@ -7085,12 +7085,15 @@ static void main_loop(void)
        next_update_time = get_time();
        info.looped = 0;
        while (terminate == 0 && (total_run_times == 0 || info.looped < total_run_times)) {
-               char buf[max_user_text];
-               get_battery_short_status(buf, max_user_text, "BAT0");
-               if(buf[0] == 'D') {
-                       update_interval = update_interval_bat;
-               } else {
-                       update_interval = update_interval_old;
+               if(update_interval_bat != update_interval_old) {
+                       char buf[max_user_text];
+
+                       get_battery_short_status(buf, max_user_text, "BAT0");
+                       if(buf[0] == 'D') {
+                               update_interval = update_interval_bat;
+                       } else {
+                               update_interval = update_interval_old;
+                       }
                }
                info.looped++;