aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-09-18 13:15:12 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-12-17 10:18:10 -0800
commit0748546f660d27a2ad29fa6174d456e2f6490758 (patch)
tree175527097b8cb08db18f558d526bccfade5344c6 /time
parentDocument TZ transition times >= 25:00:00. (diff)
downloadglibc-0748546f660d27a2ad29fa6174d456e2f6490758.tar.gz
glibc-0748546f660d27a2ad29fa6174d456e2f6490758.tar.bz2
glibc-0748546f660d27a2ad29fa6174d456e2f6490758.zip
Support TZ transition times < 00:00:00.
This is needed for version-3 tz-format files; it supports time stamps past 2037 for America/Godthab (the only entry in the tz database for which this change is relevant). * manual/time.texi (TZ Variable): Document transition times from -167:59:59 through -00:00:01. * time/tzset.c (tz_rule): Time of day is now signed. (__tzset_parse_tz): Parse negative time of day.
Diffstat (limited to 'time')
-rw-r--r--time/tzset.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/time/tzset.c b/time/tzset.c
index 4f8af8d523..fb2dccd55d 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -54,7 +54,7 @@ typedef struct
/* When to change. */
enum { J0, J1, M } type; /* Interpretation of: */
unsigned short int m, n, d; /* Month, week, day. */
- unsigned int secs; /* Time of day. */
+ int secs; /* Time of day. */
long int offset; /* Seconds east of GMT (west if < 0). */
@@ -362,9 +362,12 @@ __tzset_parse_tz (tz)
else if (*tz == '/')
{
/* Get the time of day of the change. */
+ int negative;
++tz;
if (*tz == '\0')
goto out;
+ negative = *tz == '-';
+ tz += negative;
consumed = 0;
switch (sscanf (tz, "%hu%n:%hu%n:%hu%n",
&hh, &consumed, &mm, &consumed, &ss, &consumed))
@@ -379,7 +382,7 @@ __tzset_parse_tz (tz)
break;
}
tz += consumed;
- tzr->secs = (hh * 60 * 60) + (mm * 60) + ss;
+ tzr->secs = (negative ? -1 : 1) * ((hh * 60 * 60) + (mm * 60) + ss);
}
else
/* Default to 2:00 AM. */