mirror of
https://github.com/tmux/tmux.git
synced 2025-04-05 23:58:58 +00:00
Call setlocale(LC_TIME) at startup.
This commit is contained in:
parent
cbee283c26
commit
7f9b225cc2
15
clock.c
15
clock.c
@ -103,13 +103,20 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style)
|
||||
struct grid_cell gc;
|
||||
char tim[64], *ptr;
|
||||
time_t t;
|
||||
struct tm *tm;
|
||||
u_int i, j, x, y, idx;
|
||||
|
||||
t = time(NULL);
|
||||
if (style == 0)
|
||||
strftime(tim, sizeof tim, "%l:%M %p", localtime(&t));
|
||||
else
|
||||
strftime(tim, sizeof tim, "%H:%M", localtime(&t));
|
||||
tm = localtime(&t);
|
||||
if (style == 0) {
|
||||
strftime(tim, sizeof tim, "%l:%M ", localtime(&t));
|
||||
if (tm->tm_hour >= 12)
|
||||
strlcat(tim, "PM", sizeof tim);
|
||||
else
|
||||
strlcat(tim, "AM", sizeof tim);
|
||||
} else
|
||||
strftime(tim, sizeof tim, "%H:%M", tm);
|
||||
|
||||
|
||||
screen_write_clearscreen(ctx);
|
||||
|
||||
|
3
tmux.c
3
tmux.c
@ -22,6 +22,7 @@
|
||||
#include <errno.h>
|
||||
#include <event.h>
|
||||
#include <fcntl.h>
|
||||
#include <locale.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
@ -243,6 +244,8 @@ main(int argc, char **argv)
|
||||
malloc_options = (char *) "AFGJPX";
|
||||
#endif
|
||||
|
||||
setlocale(LC_TIME, "");
|
||||
|
||||
quiet = flags = 0;
|
||||
label = path = NULL;
|
||||
login_shell = (**argv == '-');
|
||||
|
Loading…
Reference in New Issue
Block a user