=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.176 retrieving revision 1.177 diff -c -r1.176 -r1.177 *** src/usr.bin/tmux/format.c 2019/03/14 21:41:30 1.176 --- src/usr.bin/tmux/format.c 2019/03/14 23:14:27 1.177 *************** *** 1,4 **** ! /* $OpenBSD: format.c,v 1.176 2019/03/14 21:41:30 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: format.c,v 1.177 2019/03/14 23:14:27 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott *************** *** 121,126 **** --- 121,127 ---- struct client *client; u_int tag; int flags; + time_t time; RB_HEAD(format_entry_tree, format_entry) tree; }; *************** *** 682,687 **** --- 683,689 ---- ft->tag = tag; ft->flags = flags; + ft->time = time(NULL); format_add_cb(ft, "host", format_cb_host); format_add_cb(ft, "host_short", format_cb_host_short); *************** *** 1437,1443 **** value = new; } else if (modifiers & FORMAT_EXPANDTIME) { ! new = format_expand_time(ft, value, 0); free(value); value = new; } --- 1439,1445 ---- value = new; } else if (modifiers & FORMAT_EXPANDTIME) { ! new = format_expand_time(ft, value); free(value); value = new; } *************** *** 1483,1489 **** /* Expand keys in a template, passing through strftime first. */ char * ! format_expand_time(struct format_tree *ft, const char *fmt, time_t t) { struct tm *tm; char s[2048]; --- 1485,1491 ---- /* Expand keys in a template, passing through strftime first. */ char * ! format_expand_time(struct format_tree *ft, const char *fmt) { struct tm *tm; char s[2048]; *************** *** 1491,1500 **** if (fmt == NULL || *fmt == '\0') return (xstrdup("")); ! if (t == 0) ! t = time(NULL); ! tm = localtime(&t); ! if (strftime(s, sizeof s, fmt, tm) == 0) return (xstrdup("")); --- 1493,1499 ---- if (fmt == NULL || *fmt == '\0') return (xstrdup("")); ! tm = localtime(&ft->time); if (strftime(s, sizeof s, fmt, tm) == 0) return (xstrdup(""));