From a865b07a673ea4e8ea13d00f436058861d3d9ff0 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Fri, 19 Jul 2019 08:40:16 +0200 Subject: [PATCH] make the $Z time overridable --- src/core/expandos.c | 3 ++- src/core/expandos.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/expandos.c b/src/core/expandos.c index 96e2d9f3..9280b6f3 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -48,6 +48,7 @@ typedef struct { } EXPANDO_REC; const char *current_expando = NULL; +time_t current_time = (time_t)-1; static int timer_tag; @@ -441,7 +442,7 @@ static char *expando_time(SERVER_REC *server, void *item, int *free_ret) struct tm *tm; char str[256]; - now = time(NULL); + now = current_time != (time_t)-1 ? current_time : time(NULL); tm = localtime(&now); if (strftime(str, sizeof(str), timestamp_format, tm) == 0) diff --git a/src/core/expandos.h b/src/core/expandos.h index 05dfcf11..c03333a7 100644 --- a/src/core/expandos.h +++ b/src/core/expandos.h @@ -17,6 +17,7 @@ typedef char* (*EXPANDO_FUNC) (SERVER_REC *server, void *item, int *free_ret); extern const char *current_expando; +extern time_t current_time; /* Create expando - overrides any existing ones. ... = signal, type, ..., NULL - list of signals that might change the