mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
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.
This commit is contained in:
@ -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. */
|
||||
|
Reference in New Issue
Block a user