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

Re: libc/locale bug in strftime()?



It is not a problem with strftime(), it works fine here (a demo at the end
of the letter) and I'm using libc5 version 5.4.20-1.  Nor is it a bug with
locale, as you're not using it in your demo (see below).

#include <time.h>
#include <locale.h>

main()
{
  time_t cur_time = time(NULL);
  struct tm *loct;
  char *str_time, buf[128];

  setlocale(LC_ALL, "");
  str_time = ctime(&cur_time);
  printf("%s\n", str_time);
  loct = localtime(&cur_time);
  str_time = asctime(loct);
  printf("%s\n", str_time);
  strftime(buf, sizeof(buf), "%a %d %b. %Y %Z %X", loct);
  printf("%s\n", buf);
  strftime(buf, sizeof(buf), "%B", loct);
  printf("%s\n", buf);
}


----------------------------------------------------------------------------
Ørn Einar Hansen                         oe.hansen@halmstad.mail.telia.com
                                          oehansen@daimi.aau.dk
                               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: