[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building sharutils 4.13.4 with MinGW
From: |
Eli Zaretskii |
Subject: |
Re: Building sharutils 4.13.4 with MinGW |
Date: |
Sun, 07 Apr 2013 20:55:56 +0300 |
> From: Andreas Schwab <address@hidden>
> Cc: address@hidden
> Date: Sun, 07 Apr 2013 19:48:21 +0200
>
> > static char const ftime_fmt[] = "%Y-%m-%d %H:%M %Z";
> > /*
> > * All fields are two characters, except %Y is four.
> > */
> > char buffer[sizeof (ftime_fmt) + 4]; <<<<<<<<<<<<<<<
> > time_t now;
> > struct tm * local_time;
> > time (&now);
> > local_time = localtime (&now);
> > strftime (buffer, sizeof (buffer) - 1, ftime_fmt, local_time);
> >
> > which is false on Windows;
>
> It is even wrong for Unix, where timezone names can have as much as
> TZNAME_MAX (typically 6) characters, and a couple of current zones in
> the Olsen database have more than 4 characters, let alone a lot of
> historical ones.
Thanks, I didn't know about TZNAME_MAX. (It doesn't exist on Windows,
FWIW.) Windows time zones have names much longer than 6; I see a few
that are longer than 30.