diff options
author | 2015-09-10 08:58:14 +0000 | |
---|---|---|
committer | 2015-09-10 08:58:14 +0000 | |
commit | e77c256d9873828a497deb0f368987ec3587d4ba (patch) | |
tree | bd8e852e18bcaffbfa007b7bc40417641ebb63a6 | |
parent | Remove link_addr(3). A function to encode the name of an interface in (diff) | |
download | wireguard-openbsd-e77c256d9873828a497deb0f368987ec3587d4ba.tar.xz wireguard-openbsd-e77c256d9873828a497deb0f368987ec3587d4ba.zip |
Add session_last_attached time and format, from Sina Siadat.
-rw-r--r-- | usr.bin/tmux/cmd-attach-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-switch-client.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/format.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/server-fn.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
7 files changed, 23 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 0f885bcafca..df7f08d6657 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.40 2015/08/28 13:01:03 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.41 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -136,6 +136,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); s->curw->flags &= ~WINLINK_ALERTFLAGS; } else { @@ -181,6 +182,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); s->curw->flags &= ~WINLINK_ALERTFLAGS; diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 7d6238c374d..e7c0fc79162 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.70 2015/08/28 13:01:03 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.71 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -278,6 +278,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); } recalculate_sizes(); diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index d52655867be..6a6c15eaa7d 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.29 2015/08/28 13:01:03 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.30 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -129,6 +129,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) c->session = s; status_timer_start(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); recalculate_sizes(); server_check_unattached(); diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 8cc9bd9624e..7361c05b170 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.82 2015/09/03 14:30:23 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.83 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net> @@ -872,6 +872,13 @@ format_defaults_session(struct format_tree *ft, struct session *s) format_add(ft, "session_created", "%lld", (long long) t); format_add(ft, "session_created_string", "%s", format_time_string(t)); + t = s->last_attached_time.tv_sec; + if (t != 0) { /* zero if never attached */ + format_add(ft, "session_last_attached", "%lld", (long long) t); + format_add(ft, "session_last_attached_string", "%s", + format_time_string(t)); + } + t = s->activity_time.tv_sec; format_add(ft, "session_activity", "%lld", (long long) t); format_add(ft, "session_activity_string", "%s", format_time_string(t)); diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index effceceef1c..f8ee18eb531 100644 --- a/usr.bin/tmux/server-fn.c +++ b/usr.bin/tmux/server-fn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-fn.c,v 1.87 2015/08/28 13:01:03 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.88 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -422,6 +422,7 @@ server_destroy_session(struct session *s) status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s_new, NULL); + gettimeofday(&s_new->last_attached_time, NULL); server_redraw_client(c); } } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 8fc827b0b0f..8a7793032c6 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.448 2015/08/28 12:31:55 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.449 2015/09/10 08:58:14 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 28 2015 $ +.Dd $Mdocdate: September 10 2015 $ .Dt TMUX 1 .Os .Sh NAME @@ -3401,6 +3401,8 @@ The following variables are available, where appropriate: .It Li "session_activity_string" Ta "" Ta "String time of session last activity" .It Li "session_created" Ta "" Ta "Integer time session created" .It Li "session_created_string" Ta "" Ta "String time session created" +.It Li "session_last_attached" Ta "" Ta "Integer time session last attached" +.It Li "session_last_attached_string" Ta "" Ta "String time session last attached" .It Li "session_group" Ta "" Ta "Number of session group" .It Li "session_grouped" Ta "" Ta "1 if session in a group" .It Li "session_height" Ta "" Ta "Height of session" diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 50681a968a1..0a4b7edbecf 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.554 2015/09/02 17:43:25 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.555 2015/09/10 08:58:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -981,6 +981,7 @@ struct session { int cwd; struct timeval creation_time; + struct timeval last_attached_time; struct timeval activity_time; struct timeval last_activity_time; |