diff options
author | nicm <nicm> | 2019-03-14 21:27:26 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-03-14 21:27:26 +0000 |
commit | 1416ceb57589ba119a36d9f32d919d3444f7b0d0 (patch) | |
tree | eda552bce94a02e9a625eddea76c1f8bb45b5529 | |
parent | 9bd4b96766cbbdc8f8e166baf726d69e8a6024ff (diff) | |
download | rtmux-1416ceb57589ba119a36d9f32d919d3444f7b0d0.tar.gz rtmux-1416ceb57589ba119a36d9f32d919d3444f7b0d0.tar.bz2 rtmux-1416ceb57589ba119a36d9f32d919d3444f7b0d0.zip |
Accept 0 time as a shorthand for now to format_expand_time.
-rw-r--r-- | cmd-display-message.c | 2 | ||||
-rw-r--r-- | cmd-pipe-pane.c | 2 | ||||
-rw-r--r-- | format.c | 2 | ||||
-rw-r--r-- | server-client.c | 2 |
4 files changed, 5 insertions, 3 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c index 5856e2d8..6dd210ac 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -86,7 +86,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) ft = format_create(item->client, item, FORMAT_NONE, 0); format_defaults(ft, target_c, s, wl, wp); - msg = format_expand_time(ft, template, time(NULL)); + msg = format_expand_time(ft, template, 0); if (args_has(self->args, 'p')) cmdq_print(item, "%s", msg); else if (c != NULL) diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index e1bdb82d..c0d2939f 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -110,7 +110,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) /* Expand the command. */ ft = format_create(item->client, item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, wp); - cmd = format_expand_time(ft, args->argv[0], time(NULL)); + cmd = format_expand_time(ft, args->argv[0], 0); format_free(ft); /* Fork the child. */ @@ -1482,6 +1482,8 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t) if (fmt == NULL || *fmt == '\0') return (xstrdup("")); + if (t == 0) + t = time(NULL); tm = localtime(&t); if (strftime(s, sizeof s, fmt, tm) == 0) diff --git a/server-client.c b/server-client.c index b7d052a0..5bd77c84 100644 --- a/server-client.c +++ b/server-client.c @@ -1537,7 +1537,7 @@ server_client_set_title(struct client *c) ft = format_create(c, NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); - title = format_expand_time(ft, template, time(NULL)); + title = format_expand_time(ft, template, 0); if (c->title == NULL || strcmp(title, c->title) != 0) { free(c->title); c->title = xstrdup(title); |