mirror of
https://github.com/tmux/tmux.git
synced 2024-12-24 10:08:48 +00:00
Only worry about complete seconds for status line update. Also reduce poll interval and de-magic-number it.
This commit is contained in:
parent
827fac4c0b
commit
9164dd63e7
11
server.c
11
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.138 2009-04-30 20:54:53 nicm Exp $ */
|
/* $Id: server.c,v 1.139 2009-05-02 08:34:38 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -273,7 +273,7 @@ server_main(int srv_fd)
|
|||||||
/* Update socket permissions. */
|
/* Update socket permissions. */
|
||||||
xtimeout = INFTIM;
|
xtimeout = INFTIM;
|
||||||
if (sigterm || server_update_socket() != 0)
|
if (sigterm || server_update_socket() != 0)
|
||||||
xtimeout = 100;
|
xtimeout = POLL_TIMEOUT;
|
||||||
|
|
||||||
/* Do the poll. */
|
/* Do the poll. */
|
||||||
if ((nfds = poll(pfds, nfds, xtimeout)) == -1) {
|
if ((nfds = poll(pfds, nfds, xtimeout)) == -1) {
|
||||||
@ -596,12 +596,12 @@ server_check_timers(struct client *c)
|
|||||||
if (!options_get_number(&s->options, "status"))
|
if (!options_get_number(&s->options, "status"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Check timer; resolution is only a second so don't be too clever. */
|
||||||
interval = options_get_number(&s->options, "status-interval");
|
interval = options_get_number(&s->options, "status-interval");
|
||||||
if (interval == 0)
|
if (interval == 0)
|
||||||
return;
|
return;
|
||||||
|
if (tv.tv_sec < c->status_timer.tv_sec ||
|
||||||
tv.tv_sec -= interval;
|
tv.tv_sec - c->status_timer.tv_sec >= interval)
|
||||||
if (timercmp(&c->status_timer, &tv, <))
|
|
||||||
c->flags |= CLIENT_STATUS;
|
c->flags |= CLIENT_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1009,6 +1009,7 @@ server_second_timers(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for a minute having passed. */
|
||||||
gmtime_r(&t, &now);
|
gmtime_r(&t, &now);
|
||||||
gmtime_r(&last_t, &then);
|
gmtime_r(&last_t, &then);
|
||||||
if (now.tm_min == then.tm_min)
|
if (now.tm_min == then.tm_min)
|
||||||
|
5
tmux.h
5
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.309 2009-04-30 21:17:06 nicm Exp $ */
|
/* $Id: tmux.h,v 1.310 2009-05-02 08:34:39 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -127,6 +127,9 @@ extern const char *__progname;
|
|||||||
/* Escape timer period, in milliseconds. */
|
/* Escape timer period, in milliseconds. */
|
||||||
#define ESCAPE_PERIOD 250
|
#define ESCAPE_PERIOD 250
|
||||||
|
|
||||||
|
/* Maximum poll timeout (when attached). */
|
||||||
|
#define POLL_TIMEOUT 50
|
||||||
|
|
||||||
/* Fatal errors. */
|
/* Fatal errors. */
|
||||||
#define fatal(msg) log_fatal("%s: %s", __func__, msg);
|
#define fatal(msg) log_fatal("%s: %s", __func__, msg);
|
||||||
#define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
|
#define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user