]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/newlib-tumbl.git/commitdiff
* libc/time/strftime.c (strftime): Add '%h' and '%l, %k' GNU extensions.
authorChristopher Faylor <cgf@redhat.com>
Wed, 15 Jan 2003 18:52:02 +0000 (18:52 +0000)
committerChristopher Faylor <cgf@redhat.com>
Wed, 15 Jan 2003 18:52:02 +0000 (18:52 +0000)
newlib/ChangeLog
newlib/libc/time/strftime.c

index 2337ca661a5b47f09809cb3daee204e11bb06c46..628d2bfd84dcc47d7d942eefaa5f570e5583d733 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-14  Christopher Faylor  <cgf@redhat.com>
+
+       * libc/time/strftime.c (strftime): Add '%h' and '%l, %k' GNU
+       extensions.
+
 2003-01-08  Richard Sandiford  <rsandifo@redhat.com>
 
        * configure.host (mips64vr-elf, mips64vrel-elf): New config.
index 9c115b62d9d8f6ae66b1cc52d6f737ca27245184..9084d9ffb680fd6b3a264bd55fcb13ee3fcc1c9e 100644 (file)
@@ -209,6 +209,7 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
            }
          break;
        case 'b':
+       case 'h':
          for (i = 0; i < 3; i++)
            {
              if (count < maxsize - 1)
@@ -271,9 +272,10 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
            return 0;
          break;
        case 'H':
+       case 'k':
          if (count < maxsize - 2)
            {
-             sprintf (&s[count], "%2.2d",
+             sprintf (&s[count], *format == 'k' ? "%2d" : "%2.2d",
                       tim_p->tm_hour);
              count += 2;
            }
@@ -281,6 +283,7 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
            return 0;
          break;
        case 'I':
+       case 'l':
          if (count < maxsize - 2)
            {
              if (tim_p->tm_hour == 0 ||
@@ -291,7 +294,7 @@ _DEFUN (strftime, (s, maxsize, format, tim_p),
                }
              else
                {
-                 sprintf (&s[count], "%.2d",
+                 sprintf (&s[count], (*format == 'I') ? "%.2d" : "%2d",
                           tim_p->tm_hour % 12);
                  count += 2;
                }