diff options
author | Christopher Faylor <me@cgf.cx> | 2003-01-15 18:52:02 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-01-15 18:52:02 +0000 |
commit | 845102177a0d9b2edea95e0e411cf27ccb448c75 (patch) | |
tree | 9cccbb59b0f21b7007d3c2def50e9e216cdc28f4 /newlib/libc/time/strftime.c | |
parent | 77cb0c56ef3dd24d7e5e29bac4c556357ee4b7da (diff) | |
download | cygnal-845102177a0d9b2edea95e0e411cf27ccb448c75.tar.gz cygnal-845102177a0d9b2edea95e0e411cf27ccb448c75.tar.bz2 cygnal-845102177a0d9b2edea95e0e411cf27ccb448c75.zip |
* libc/time/strftime.c (strftime): Add '%h' and '%l, %k' GNU extensions.
Diffstat (limited to 'newlib/libc/time/strftime.c')
-rw-r--r-- | newlib/libc/time/strftime.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 9c115b62d..9084d9ffb 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -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; } |