[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc/locale bug in strftime()?

Looking a  little better at your code... I expect you are assuming that
the memory allocation routine, has null'ed your data (I think I remember
that a 'struct tm' filled with zeroes should give Jan 1, 1970?).  This
is the source of your greaf, your 'struct tm' is not properly initalized
before a call to strftime().  You don't dynamically allocate your
structure, but it is allocated on the runtime stack, therefore it most
likely contains rubbish data, that breaks strftime().

>  char s[32];
>  struct tm tm;
>  tm.tm_mon=1;
>  strftime(s,32,"%b",&tm);

Ørn Einar Hansen                         oe.hansen@halmstad.mail.telia.com
                               home+fax; +46 035 217194

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com

Reply to: