I forgot that I did this before and just found it... diff --git a/clock.c b/clock.c index 49a883c..ec74288 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); diff --git a/tmux.c b/tmux.c index 8ea91eb..2f641f5 100644 --- a/tmux.c +++ b/tmux.c @@ -22,6 +22,7 @@ #include <errno.h> #include <event.h> #include <fcntl.h> +#include <locale.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -244,6 +245,8 @@ main(int argc, char **argv) malloc_options = (char *) "AFGJPX"; #endif + setlocale(LC_TIME, ""); + quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-');
On Wed, Apr 10, 2013 at 01:02:24PM +0100, Nicholas Marriott wrote: > I think this is not enough because clock.c uses strftime %p. It'll need > a small change to make it use a fixed "AM" or "PM" string instead of > %p. Do you want to do that too? > > > On Fri, Apr 05, 2013 at 06:24:54PM +0200, Thomas Nemeth wrote: > > > > Hi. > > > > I've been using tmux for a long time and a fact stroke me: even > > when using strftime, the date is always displayed in english. I've > > been compiling tmux after each new version in order to have the > > date in my language. > > > > Would it be possible to integrate my patch ? > > > > Here it is as attachment. > > > > > > Thomas. > > > diff -Naurp tmux-1.8/tmux.c tmux-1.8.new/tmux.c > > --- tmux-1.8/tmux.c 2013-03-26 20:22:31.000000000 +0100 > > +++ tmux-1.8.new/tmux.c 2013-04-05 18:16:10.127349392 +0200 > > @@ -26,6 +26,7 @@ > > #include <stdlib.h> > > #include <string.h> > > #include <unistd.h> > > +#include <locale.h> > > > > #include "tmux.h" > > > > @@ -244,6 +245,8 @@ main(int argc, char **argv) > > malloc_options = (char *) "AFGJPX"; > > #endif > > > > + setlocale(LC_ALL, ""); > > + > > quiet = flags = 0; > > label = path = NULL; > > login_shell = (**argv == '-'); > > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html > > > _______________________________________________ > > tmux-users mailing list > > tmux-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/tmux-users > ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users