----- Mail original -----
> De: "Nicholas Marriott" <[email protected]>
> À: "Thomas Nemeth" <[email protected]>
> Cc: [email protected]
> Envoyé: Vendredi 12 Avril 2013 15:18:32
> Objet: Re: tmux and locales
>
> We have a font to draw the large letters and it only has 0-9 A, P and
> M. So we have to use those.
Oh yes. I forgot the "fullscreen" time display.
> On Fri, Apr 12, 2013 at 03:11:42PM +0200, Thomas Nemeth wrote:
> > According to the strftime man page,
> >
> > %p Either ???AM??? or ???PM??? according to the given
> > time value, or the
> > corresponding strings for the current locale. Noon
> > is treated
> > as ???pm??? and midnight as ???am???.
> >
> > %P Like %p but in lowercase: ???am??? or ???pm??? or a
> > corresponding string
> > for the current locale. (GNU)
> >
> >
> > What problem does that mean ? Why not using %p ? Is locking
> > "AM" and "PM"
> > in only one language a good thing ?
> > -- not that I bother much : I prefer the 24h format ;)
> >
> > However will you commit your patch :) ?
> >
> >
> >
> > ----- Mail original -----
> > > De: "Nicholas Marriott" <[email protected]>
> > > ??: "Thomas Nemeth" <[email protected]>
> > > Cc: [email protected]
> > > Envoy??: Jeudi 11 Avril 2013 23:47:54
> > > Objet: Re: tmux and locales
> > >
> > > 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?
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users