summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2011-04-22 01:06:53 +0200
committerMichael Stapelberg <michael@stapelberg.de>2011-04-22 01:06:53 +0200
commit28934ef858e094bac998556df85a082bee923a96 (patch)
treebefdbdd3e83532f7d05ef25313f39c9a84754b1e
parent4fa8a4e0ab52d5e804e3d85c04281d392c767b22 (diff)
Bugfix: use localtime_r so that later calls in print_battery_info don’t overwrite the time
-rw-r--r--i3status.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/i3status.c b/i3status.c
index d219b3c..7f426f2 100644
--- a/i3status.c
+++ b/i3status.c
@@ -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();