mirror of git://sourceware.org/git/glibc.git
(tz_compute): Correct last patch and describe this in a comment.
This commit is contained in:
parent
d499a27c88
commit
14f65de694
20
time/tzset.c
20
time/tzset.c
|
|
@ -517,20 +517,16 @@ tz_compute (timer, tm)
|
||||||
time_t timer;
|
time_t timer;
|
||||||
const struct tm *tm;
|
const struct tm *tm;
|
||||||
{
|
{
|
||||||
if (! compute_change (&tz_rules[0], 1900 + tm->tm_year))
|
if (! compute_change (&tz_rules[0], 1900 + tm->tm_year)
|
||||||
|
|| ! compute_change (&tz_rules[1], 1900 + tm->tm_year))
|
||||||
return 0;
|
return 0;
|
||||||
/* We have to distinguish between northern and southern hemisphere.
|
/* We have to distinguish between northern and southern hemisphere.
|
||||||
For the later the daylight saving time ends in the next year. */
|
For the later the daylight saving time ends in the next year.
|
||||||
if (tz_rules[0].change < tz_rules[1].change)
|
It is easier to detect this after first computing the time for the
|
||||||
{
|
wrong year since now we simply can compare the times to switch. */
|
||||||
if (! compute_change (&tz_rules[1], 1900 + tm->tm_year))
|
if (tz_rules[0].change < tz_rules[1].change
|
||||||
return 0;
|
&& ! compute_change (&tz_rules[1], 1900 + tm->tm_year + 1))
|
||||||
}
|
return 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! compute_change (&tz_rules[1], 1900 + tm->tm_year + 1))
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__daylight = tz_rules[0].offset != tz_rules[1].offset;
|
__daylight = tz_rules[0].offset != tz_rules[1].offset;
|
||||||
__timezone = -tz_rules[0].offset;
|
__timezone = -tz_rules[0].offset;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue