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