mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Merge pull request #1087 from ailin-nemui/time-expando-override
make the $Z time overridable
This commit is contained in:
commit
fa0ecb688d
@ -48,6 +48,7 @@ typedef struct {
|
|||||||
} EXPANDO_REC;
|
} EXPANDO_REC;
|
||||||
|
|
||||||
const char *current_expando = NULL;
|
const char *current_expando = NULL;
|
||||||
|
time_t current_time = (time_t)-1;
|
||||||
|
|
||||||
static int timer_tag;
|
static int timer_tag;
|
||||||
|
|
||||||
@ -441,7 +442,7 @@ static char *expando_time(SERVER_REC *server, void *item, int *free_ret)
|
|||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
char str[256];
|
char str[256];
|
||||||
|
|
||||||
now = time(NULL);
|
now = current_time != (time_t)-1 ? current_time : time(NULL);
|
||||||
tm = localtime(&now);
|
tm = localtime(&now);
|
||||||
|
|
||||||
if (strftime(str, sizeof(str), timestamp_format, tm) == 0)
|
if (strftime(str, sizeof(str), timestamp_format, tm) == 0)
|
||||||
|
@ -17,6 +17,7 @@ typedef char* (*EXPANDO_FUNC)
|
|||||||
(SERVER_REC *server, void *item, int *free_ret);
|
(SERVER_REC *server, void *item, int *free_ret);
|
||||||
|
|
||||||
extern const char *current_expando;
|
extern const char *current_expando;
|
||||||
|
extern time_t current_time;
|
||||||
|
|
||||||
/* Create expando - overrides any existing ones.
|
/* Create expando - overrides any existing ones.
|
||||||
... = signal, type, ..., NULL - list of signals that might change the
|
... = signal, type, ..., NULL - list of signals that might change the
|
||||||
|
Loading…
Reference in New Issue
Block a user