This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4772] strptime() doesn't support strftime()'s flags


------- Additional Comments From tomek at jot23 dot org  2007-07-11 09:02 -------
Well, then consider this: in Polish locale strptime fails to
parse time formated with stftime with the following flags:
"%c" and "%x" (using these flags as format specifier for
strptime itself and this is documented as valid in man page).
I bet 100$ that this boils down to this problem and another
100$ that this is very close to violation of the rule you
specified in comment #8 above.
The code to prove my point:
#include <clocale>
#include <ctime>
#include <iostream>
#include <langinfo.h>

void checkfmt(const char *fmt)
{
  using std::cout;
  using std::endl;
  time_t t;
  tm t1, t2;
  char *p, buf[128];
  t = time(NULL);
  t1 = *localtime(&t);
  cout << "format string: " << fmt << endl;
  strftime(buf, sizeof(buf), fmt, &t1);
  cout << "strftime (1): " << buf << endl;
  memset(&t2, 0, sizeof(t2));
  p = strptime(buf, fmt, &t2);
  strftime(buf, sizeof(buf), fmt, &t2);
  cout << "strftime (2): " << buf << endl;
  cout << "--------------------------------------------------" << endl;
}

int main()
{
  setlocale(LC_ALL, "pl_PL.UTF8");
  checkfmt(nl_langinfo(D_FMT));
  checkfmt("%a");
  checkfmt("%A");
  checkfmt("%b");
  checkfmt("%B");
  checkfmt("%c");
  checkfmt("%x");
  checkfmt("%X");
  return(0);
}
Feel free to close if I am wrong but then we need another
bug for strptime to fix %c and %x formats.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


http://sourceware.org/bugzilla/show_bug.cgi?id=4772

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]