diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-04-16 10:39:48 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-04-16 10:39:48 +0100 |
commit | 9e537c808b95e01165f1c2831b3737b93c0110c3 (patch) | |
tree | c4e0394a8c366356187696f03cf6cd21923ca42a /clock.c | |
parent | 4ccb2e2c218a10a8039ca801231aaf09b6bf3bce (diff) | |
parent | 2c4543b9e9bd38bcc45393dad94930bcde872e6c (diff) | |
download | rtmux-9e537c808b95e01165f1c2831b3737b93c0110c3.tar.gz rtmux-9e537c808b95e01165f1c2831b3737b93c0110c3.tar.bz2 rtmux-9e537c808b95e01165f1c2831b3737b93c0110c3.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); |