[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-bugs
Subject:    [haiku-bugs] Re: [Haiku] #18471: strftime() broken for "c" and "X" specifiers.
From:       Haiku <trac () haiku-os ! org>
Date:       2024-04-15 9:34:43
Message-ID: 058.9a497a68b80093f6f501a66ccf2d0be6 () haiku-os ! org
[Download RAW message or body]

--============== 77303708739273557=MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

#18471: strftime() broken for "c" and "X" specifiers.
------------------------+-------------------------
  Reporter:  bipolar    |      Owner:  nobody
      Type:  bug        |     Status:  closed
  Priority:  normal     |  Milestone:  Unscheduled
 Component:  - General  |    Version:  R1/beta4
Resolution:  invalid    |   Keywords:
Blocked By:             |   Blocking:
  Platform:  All        |
------------------------+-------------------------
Comment (by bipolar):

 Updating the test case to:

 {{{#!c
 #include <clocale>
 #include <ctime>
 #include <cstdio>
 #include <cstring>

 void dotest()
 {
         // Python's test data: {1999, 3, 17, 22, 44, 55, 2, 76, 0}
         struct tm time = {55, 44, 22, 17, 2, 99, 3, 75, 0};
         const char specifiers[] = "aAbBcCdDehHIjmMnprRStTUwWxXyY%";

         for (int i=0; i < strlen(specifiers); i++) {
                 char fmt[3] = {};
                 char buffer[80] = {};

                 sprintf(fmt, "%%%c", specifiers[i]);
                 strftime(buffer, 80, fmt, &time);

                 printf("Testing '%c': '%s'\n", specifiers[i], buffer);
         }
 }


 int main(void)
 {
         puts("Testing with default locale:");
         dotest();

         puts("Testing after: setlocale(LC_TIME, \"es_AR.utf8\")");
         setlocale(LC_TIME, "es_AR.utf8");
         dotest();
 }
 }}}

 Shows an empty value for `%c` after setting the locale to `es_AR.utf8`
 (same as talked [https://dev.haiku-os.org/ticket/14356#comment:2 here and
 subsequent comments]).

 So, I guess I might have tested with different locales, and that's why I
 was getting different results.

 `%X` specifier looks fine tho, so that might be an issue on our Python's
 port side.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/18471#comment:4>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

--============== 77303708739273557==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic