aboutsummaryrefslogtreecommitdiff
path: root/clock.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-05-31 13:00:11 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-05-31 13:00:11 +0100
commit2ee9c4df12429d4f6fb8f06a373fdd5c0347049c (patch)
tree1c241b4bcd2e637cbae11d7fb6b34840d9839ec7 /clock.c
parente6c77e7afbcee07ed6237f2a0f30e70f45ecf0ba (diff)
parent76cb088d16fd5aa47b54428368ef403cbbcf4f5a (diff)
downloadrtmux-2ee9c4df12429d4f6fb8f06a373fdd5c0347049c.tar.gz
rtmux-2ee9c4df12429d4f6fb8f06a373fdd5c0347049c.tar.bz2
rtmux-2ee9c4df12429d4f6fb8f06a373fdd5c0347049c.zip
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'clock.c')
-rw-r--r--clock.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/clock.c b/clock.c
index 49a883cf..ec742884 100644
--- a/clock.c
+++ b/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);