summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/clock.c17
-rw-r--r--usr.bin/tmux/tmux.c5
2 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/tmux/clock.c b/usr.bin/tmux/clock.c
index e1026591824..ee91410f385 100644
--- a/usr.bin/tmux/clock.c
+++ b/usr.bin/tmux/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.6 2009/12/03 22:50:09 nicm Exp $ */
+/* $OpenBSD: clock.c,v 1.7 2013/04/11 21:52:18 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 94c1f3cdaa7..8f680fadbda 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.118 2013/03/27 11:24:18 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.119 2013/04/11 21:52:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 == '-');