diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-06-27 14:40:22 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-06-27 14:40:22 +0000 |
commit | 710393e388c0adf8b36854b60c466b21f1a9eb12 (patch) | |
tree | 0e823cdcfb4036eff3ffcafd72e5f616a66c5d52 /window-clock.c | |
parent | 2660692fb18499bedd1f81f8ec88fab1acfd80bc (diff) | |
download | rtmux-710393e388c0adf8b36854b60c466b21f1a9eb12.tar.gz rtmux-710393e388c0adf8b36854b60c466b21f1a9eb12.tar.bz2 rtmux-710393e388c0adf8b36854b60c466b21f1a9eb12.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.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/window-clock.c b/window-clock.c index e84635f6..49239180 100644 --- a/window-clock.c +++ b/window-clock.c @@ -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; |