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.
This commit is contained in:
Nicholas Marriott 2009-06-29 22:03:36 +00:00
parent edc2e7da98
commit 18ebc99906

View File

@ -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> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -93,13 +93,13 @@ void
window_clock_timer(struct window_pane *wp) window_clock_timer(struct window_pane *wp)
{ {
struct window_clock_mode_data *data = wp->modedata; struct window_clock_mode_data *data = wp->modedata;
struct tm *now, *then; struct tm now, then;
time_t t; time_t t;
t = time(NULL); t = time(NULL);
now = gmtime(&t); gmtime_r(&t, &now);
then = gmtime(&data->tim); gmtime_r(&data->tim, &then);
if (now->tm_min == then->tm_min) if (now.tm_min == then.tm_min)
return; return;
data->tim = t; data->tim = t;