From 53bf8bcb01812254ea58e5a531f0e95637ed93eb Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 21 Jul 2011 22:46:35 +0200 Subject: [PATCH] Bugfix: Use gettimeofday instead of time. It provides higher precision. Otherwise, we sometimes have a wrong date/time. --- i3status.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/i3status.c b/i3status.c index 08ed940..97e081b 100644 --- a/i3status.c +++ b/i3status.c @@ -344,7 +344,9 @@ int main(int argc, char *argv[]) { struct tm tm; while (1) { - time_t current_time = time(NULL); + struct timeval tv; + gettimeofday(&tv, NULL); + time_t current_time = tv.tv_sec; struct tm *current_tm = NULL; if (current_time != (time_t) -1) { localtime_r(¤t_time, &tm); -- 2.39.5