summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window-clock.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-06-27 14:40:22 +0000
committernicm <nicm@openbsd.org>2009-06-27 14:40:22 +0000
commitee200a5030f5e1d4b9f530e27c9c0ae215411d10 (patch)
tree56b23db2580b88e0b8a09c462f9303acf0d9b934 /usr.bin/tmux/window-clock.c
parentsync description of struct audio_prinfo; (diff)
downloadwireguard-openbsd-ee200a5030f5e1d4b9f530e27c9c0ae215411d10.tar.xz
wireguard-openbsd-ee200a5030f5e1d4b9f530e27c9c0ae215411d10.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 'usr.bin/tmux/window-clock.c')
-rw-r--r--usr.bin/tmux/window-clock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tmux/window-clock.c b/usr.bin/tmux/window-clock.c
index 1cc748e44d4..8a68dd3778b 100644
--- a/usr.bin/tmux/window-clock.c
+++ b/usr.bin/tmux/window-clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-clock.c,v 1.1 2009/06/01 22:58:49 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;