aboutsummaryrefslogtreecommitdiff
path: root/window-clock.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-06-29 22:03:36 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-06-29 22:03:36 +0000
commit18ebc99906eef717ee93005e6b4fc482cf7cb4a2 (patch)
tree181d4b0dc2701763331306eb50947ce8ed8a20a6 /window-clock.c
parentedc2e7da988cc547016c6d80f9f7a7c415ece28e (diff)
downloadrtmux-18ebc99906eef717ee93005e6b4fc482cf7cb4a2.tar.gz
rtmux-18ebc99906eef717ee93005e6b4fc482cf7cb4a2.tar.bz2
rtmux-18ebc99906eef717ee93005e6b4fc482cf7cb4a2.zip
Use gmtime_r so the current time isn't overwritten, the minute comparison works
and the clock is actually updated. It was already used for lock-server but not here.
Diffstat (limited to 'window-clock.c')
-rw-r--r--window-clock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/window-clock.c b/window-clock.c
index f4bcc526..8a68dd37 100644
--- a/window-clock.c
+++ b/window-clock.c
@@ -1,4 +1,4 @@
-/* $Id: window-clock.c,v 1.5 2009-01-28 19:52:21 nicm Exp $ */
+/* $OpenBSD: window-clock.c,v 1.2 2009/06/27 14:40:22 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -93,13 +93,13 @@ void
window_clock_timer(struct window_pane *wp)
{
struct window_clock_mode_data *data = wp->modedata;
- struct tm *now, *then;
+ struct tm now, then;
time_t t;
t = time(NULL);
- now = gmtime(&t);
- then = gmtime(&data->tim);
- if (now->tm_min == then->tm_min)
+ gmtime_r(&t, &now);
+ gmtime_r(&data->tim, &then);
+ if (now.tm_min == then.tm_min)
return;
data->tim = t;