summaryrefslogtreecommitdiff
path: root/time/strptime_l.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-27 11:31:41 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-27 11:31:41 +0000
commit35278cc7d7fe81e01bb092e76b775c169e7e85f6 (patch)
tree6ec42ab959998df5c0182183807ee2b9efc4cc91 /time/strptime_l.c
parent536db0d3b5efac042be3bf1d6f99f9c418f76255 (diff)
Updated to fedora-glibc-20050427T1043
Diffstat (limited to 'time/strptime_l.c')
-rw-r--r--time/strptime_l.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 01c4f8282a..dc0cc686fd 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -687,6 +687,42 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
case 'Z':
/* XXX How to handle this? */
break;
+ case 'z':
+ /* We recognize two formats: if two digits are given, these
+ specify hours. If fours digits are used, minutes are
+ also specified. */
+ {
+ val = 0;
+ while (*rp == ' ')
+ ++rp;
+ if (*rp != '+' && *rp != '-')
+ return NULL;
+ bool neg = *rp++ == '-';
+ int n = 0;
+ while (n < 4 && *rp >= '0' && *rp <= '9')
+ {
+ val = val * 10 + *rp++ - '0';
+ ++n;
+ }
+ if (n == 2)
+ val *= 100;
+ else if (n != 4)
+ /* Only two or four digits recognized. */
+ return NULL;
+ else
+ {
+ /* We have to convert the minutes into decimal. */
+ if (val % 100 >= 60)
+ return NULL;
+ val = (val / 100) * 100 + ((val % 100) * 50) / 30;
+ }
+ if (val > 1200)
+ return NULL;
+ tm->tm_gmtoff = (val * 3600) / 100;
+ if (neg)
+ tm->tm_gmtoff = -tm->tm_gmtoff;
+ }
+ break;
case 'E':
#ifdef _NL_CURRENT
switch (*fmt++)