1
0
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:
Nicholas Marriott 2013-04-11 21:52:18 +00:00
parent cbee283c26
commit 7f9b225cc2
2 changed files with 14 additions and 4 deletions

15
clock.c
View File

@ -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
View File

@ -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 == '-');