diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-05-31 13:00:11 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-05-31 13:00:11 +0100 |
commit | 2ee9c4df12429d4f6fb8f06a373fdd5c0347049c (patch) | |
tree | 1c241b4bcd2e637cbae11d7fb6b34840d9839ec7 /clock.c | |
parent | e6c77e7afbcee07ed6237f2a0f30e70f45ecf0ba (diff) | |
parent | 76cb088d16fd5aa47b54428368ef403cbbcf4f5a (diff) | |
download | rtmux-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.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); |