]> git.sur5r.net Git - i3/i3status/commitdiff
Bugfix: use localtime_r so that later calls in print_battery_info don’t overwrite...
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 21 Apr 2011 23:06:53 +0000 (01:06 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 21 Apr 2011 23:06:53 +0000 (01:06 +0200)
i3status.c

index d219b3c95dcd8ab322c828dfa7dd5d0761895e95..7f426f2f5f531ce596b92e0dac673d1ff44c43af 100644 (file)
@@ -321,11 +321,14 @@ int main(int argc, char *argv[]) {
 
         int interval = cfg_getint(cfg_general, "interval");
 
+        struct tm tm;
         while (1) {
                 time_t current_time = time(NULL);
                 struct tm *current_tm = NULL;
-                if (current_time != (time_t) -1)
-                        current_tm = localtime(&current_time);
+                if (current_time != (time_t) -1) {
+                        localtime_r(&current_time, &tm);
+                        current_tm = &tm;
+                }
                 for (j = 0; j < cfg_size(cfg, "order"); j++) {
                         if (j > 0)
                                 print_seperator();