summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2011-07-21 22:46:35 +0200
committerMichael Stapelberg <michael@stapelberg.de>2011-07-21 22:46:35 +0200
commit53bf8bcb01812254ea58e5a531f0e95637ed93eb (patch)
tree279571ce924685bd40e9866d6d89c42ead33806d /i3status.c
parent5e276db583ba94e8e303c8868df52ffcaa0819a4 (diff)
Bugfix: Use gettimeofday instead of time. It provides higher precision.
Otherwise, we sometimes have a wrong date/time.
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c4
1 files changed, 3 insertions, 1 deletions
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(&current_time, &tm);