From 28934ef858e094bac998556df85a082bee923a96 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 22 Apr 2011 01:06:53 +0200 Subject: [PATCH] =?utf8?q?Bugfix:=20use=20localtime=5Fr=20so=20that=20late?= =?utf8?q?r=20calls=20in=20print=5Fbattery=5Finfo=20don=E2=80=99t=20overwr?= =?utf8?q?ite=20the=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- i3status.c | 7 +++++-- 1 file 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(¤t_time); + if (current_time != (time_t) -1) { + localtime_r(¤t_time, &tm); + current_tm = &tm; + } for (j = 0; j < cfg_size(cfg, "order"); j++) { if (j > 0) print_seperator(); -- 2.39.5