From: Michael Stapelberg Date: Thu, 21 Jul 2011 20:46:35 +0000 (+0200) Subject: Bugfix: Use gettimeofday instead of time. It provides higher precision. X-Git-Tag: 2.3~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=53bf8bcb01812254ea58e5a531f0e95637ed93eb;p=i3%2Fi3status Bugfix: Use gettimeofday instead of time. It provides higher precision. Otherwise, we sometimes have a wrong date/time. --- 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);