aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/strptime_l.c12
-rw-r--r--time/tst-strptime2.c21
2 files changed, 22 insertions, 11 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 5640cce..4203ad8 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -770,16 +770,10 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
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)
+ else if (val % 100 >= 60)
+ /* Minutes valid range is 0 through 59. */
return NULL;
- tm->tm_gmtoff = (val * 3600) / 100;
+ tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
if (neg)
tm->tm_gmtoff = -tm->tm_gmtoff;
}
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
index a08e6d7..4db8321 100644
--- a/time/tst-strptime2.c
+++ b/time/tst-strptime2.c
@@ -17,8 +17,25 @@ static const struct
{ "1113472456 -1030", -37800 },
{ "1113472456 +0030", 1800 },
{ "1113472456 -0030", -1800 },
- { "1113472456 -1330", LONG_MAX },
- { "1113472456 +1330", LONG_MAX },
+ { "1113472456 +1157", 43020 },
+ { "1113472456 +1158", 43080 },
+ { "1113472456 +1159", 43140 },
+ { "1113472456 +1200", 43200 },
+ { "1113472456 -1200", -43200 },
+ { "1113472456 +1201", 43260 },
+ { "1113472456 -1201", -43260 },
+ { "1113472456 +1330", 48600 },
+ { "1113472456 -1330", -48600 },
+ { "1113472456 +1400", 50400 },
+ { "1113472456 +1401", 50460 },
+ { "1113472456 -2459", -89940 },
+ { "1113472456 -2500", -90000 },
+ { "1113472456 +2559", 93540 },
+ { "1113472456 +2600", 93600 },
+ { "1113472456 -99", -356400 },
+ { "1113472456 +99", 356400 },
+ { "1113472456 -9959", -359940 },
+ { "1113472456 +9959", 359940 },
{ "1113472456 -1060", LONG_MAX },
{ "1113472456 +1060", LONG_MAX },
{ "1113472456 1030", LONG_MAX },