summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/format.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-09-10 08:58:15 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-09-10 08:58:15 +0000
commitb955f91039c600cc9ebad4b4a26b2b3b17ac40c4 (patch)
tree1d55cf5330e1e82eaa326b91d6f93ba7de57d7f6 /usr.bin/tmux/format.c
parente574bf2f3e3ca84e5c96f5c4cae158d03b2427f0 (diff)
Add session_last_attached time and format, from Sina Siadat.
Diffstat (limited to 'usr.bin/tmux/format.c')
-rw-r--r--usr.bin/tmux/format.c9
1 files changed, 8 insertions, 1 deletions
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));