diff options
| author | Michael Stapelberg <michael@stapelberg.de> | 2011-07-21 22:46:35 +0200 | 
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2011-07-21 22:46:35 +0200 | 
| commit | 53bf8bcb01812254ea58e5a531f0e95637ed93eb (patch) | |
| tree | 279571ce924685bd40e9866d6d89c42ead33806d | |
| parent | 5e276db583ba94e8e303c8868df52ffcaa0819a4 (diff) | |
Bugfix: Use gettimeofday instead of time. It provides higher precision.
Otherwise, we sometimes have a wrong date/time.
| -rw-r--r-- | i3status.c | 4 | 
1 files changed, 3 insertions, 1 deletions
| @@ -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); | 
