mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Update.
* time/mktime.c (__mktime_internal): Correct last change. We must stop searching for the right isdst value before stepping to the initial value.
This commit is contained in:
parent
3ddfec55c4
commit
98b567ffae
@ -1,5 +1,9 @@
|
|||||||
1998-11-04 Ulrich Drepper <drepper@cygnus.com>
|
1998-11-04 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* time/mktime.c (__mktime_internal): Correct last change. We must
|
||||||
|
stop searching for the right isdst value before stepping to the
|
||||||
|
initial value.
|
||||||
|
|
||||||
* malloc/malloc.c: Make sure calloc really returned zeroed memory.
|
* malloc/malloc.c: Make sure calloc really returned zeroed memory.
|
||||||
Patch by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>.
|
Patch by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>.
|
||||||
|
|
||||||
|
@ -350,44 +350,32 @@ __mktime_internal (tp, convert, offset)
|
|||||||
|
|
||||||
/* If we have a match, check whether tm.tm_isdst has the requested
|
/* If we have a match, check whether tm.tm_isdst has the requested
|
||||||
value, if any. */
|
value, if any. */
|
||||||
if (dt == 0 && isdst >= 0 && isdst != tm.tm_isdst)
|
if (dt == 0 && 0 <= isdst && 0 <= tm.tm_isdst)
|
||||||
{
|
{
|
||||||
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
|
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
|
||||||
if (dst_diff)
|
if (dst_diff)
|
||||||
{
|
{
|
||||||
/* Move three hours in the direction indicated by the disagreement,
|
/* Move two hours in the direction indicated by the disagreement,
|
||||||
probe some more, and switch to a new time if found.
|
probe some more, and switch to a new time if found.
|
||||||
The largest known fallback due to daylight savings is two hours:
|
The largest known fallback due to daylight savings is two hours:
|
||||||
once, in Newfoundland, 1988-10-30 02:00 -> 00:00.
|
once, in Newfoundland, 1988-10-30 02:00 -> 00:00. */
|
||||||
But some programs (e.g. testsuites) probe for larger differences
|
time_t ot = t - 2 * 60 * 60 * dst_diff;
|
||||||
between DST and normal time so switch by three hours. No
|
|
||||||
normal program does this so we do not account for more than
|
|
||||||
three hours difference. */
|
|
||||||
time_t ot = t - 3 * 60 * 60 * dst_diff;
|
|
||||||
struct tm otm;
|
|
||||||
struct tm tmptm;
|
|
||||||
|
|
||||||
otm.tm_isdst = -1;
|
|
||||||
|
|
||||||
while (--remaining_probes != 0)
|
while (--remaining_probes != 0)
|
||||||
{
|
{
|
||||||
if (! (dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
struct tm otm;
|
||||||
ranged_convert (convert, &ot,
|
dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
||||||
&tmptm)))
|
ranged_convert (convert, &ot, &otm));
|
||||||
|| tmptm.tm_isdst != isdst)
|
if (dt == 0
|
||||||
break;
|
|| (ot + dt == t
|
||||||
|
&& dst_diff == (isdst != 0) - (tm.tm_isdst != 0)))
|
||||||
otm = tmptm;
|
{
|
||||||
ot += dt;
|
t = ot;
|
||||||
if (ot == t)
|
tm = otm;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((ot += dt) == t)
|
||||||
break; /* Avoid a redundant probe. */
|
break; /* Avoid a redundant probe. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otm.tm_isdst != -1)
|
|
||||||
{
|
|
||||||
t = ot;
|
|
||||||
tm = otm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user