diff options
author | Thomas Adam <thomas@xteddy.org> | 2013-04-13 17:05:49 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2013-04-13 17:05:49 +0100 |
commit | b58bca9a72009101da373a3b7463fd866ecac58c (patch) | |
tree | e8f9b4b720b4c05f67fd47505b5170c4fd33dcb0 /clock.c | |
parent | e312db140868754358d40ec17595327a8fbbf180 (diff) | |
parent | 27dcf470dc4aa5901ac7f01b3a9f971e02f2229e (diff) | |
download | rtmux-b58bca9a72009101da373a3b7463fd866ecac58c.tar.gz rtmux-b58bca9a72009101da373a3b7463fd866ecac58c.tar.bz2 rtmux-b58bca9a72009101da373a3b7463fd866ecac58c.zip |
Merge branch 'obsd-master'
Conflicts:
tmux.c
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); |