mirror of git://sourceware.org/git/glibc.git
Update.
2002-02-02 Paul Eggert <eggert@twinsun.com> * src/mktime.c [defined DEBUG && STDC_HEADERS]: Include <string.h>. (__mktime_internal): If no tm_isdst is requested, prefer solutions with tm_isdst > 0 when the requested time falls within a spring-forward gap [PR libc/2894].
This commit is contained in:
parent
352b06fdbf
commit
b5ef404e08
|
@ -1,3 +1,10 @@
|
||||||
|
2002-02-02 Paul Eggert <eggert@twinsun.com>
|
||||||
|
|
||||||
|
* src/mktime.c [defined DEBUG && STDC_HEADERS]: Include <string.h>.
|
||||||
|
(__mktime_internal): If no tm_isdst is requested, prefer solutions
|
||||||
|
with tm_isdst > 0 when the requested time falls within a
|
||||||
|
spring-forward gap [PR libc/2894].
|
||||||
|
|
||||||
2002-02-03 Andreas Schwab <schwab@suse.de>
|
2002-02-03 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* stdio-common/tst-rndseek.c: Increase timeout.
|
* stdio-common/tst-rndseek.c: Increase timeout.
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# if STDC_HEADERS
|
# if STDC_HEADERS
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
# include <string.h>
|
||||||
# endif
|
# endif
|
||||||
/* Make it work even if the system's libc has its own mktime routine. */
|
/* Make it work even if the system's libc has its own mktime routine. */
|
||||||
# define mktime my_mktime
|
# define mktime my_mktime
|
||||||
|
@ -236,6 +237,9 @@ __mktime_internal (struct tm *tp,
|
||||||
int year_requested = tp->tm_year;
|
int year_requested = tp->tm_year;
|
||||||
int isdst = tp->tm_isdst;
|
int isdst = tp->tm_isdst;
|
||||||
|
|
||||||
|
/* 1 if the previous probe was DST. */
|
||||||
|
int dst2;
|
||||||
|
|
||||||
/* Ensure that mon is in range, and set year accordingly. */
|
/* Ensure that mon is in range, and set year accordingly. */
|
||||||
int mon_remainder = mon % 12;
|
int mon_remainder = mon % 12;
|
||||||
int negative_mon_remainder = mon_remainder < 0;
|
int negative_mon_remainder = mon_remainder < 0;
|
||||||
|
@ -270,20 +274,24 @@ __mktime_internal (struct tm *tp,
|
||||||
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
||||||
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
|
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
|
||||||
|
|
||||||
for (t = t1 = t2 = t0 + *offset;
|
for (t = t1 = t2 = t0 + *offset, dst2 = 0;
|
||||||
(dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
(dt = ydhms_tm_diff (year, yday, hour, min, sec,
|
||||||
ranged_convert (convert, &t, &tm)));
|
ranged_convert (convert, &t, &tm)));
|
||||||
t1 = t2, t2 = t, t += dt)
|
t1 = t2, t2 = t, t += dt, dst2 = tm.tm_isdst != 0)
|
||||||
if (t == t1 && t != t2
|
if (t == t1 && t != t2
|
||||||
&& (isdst < 0 || tm.tm_isdst < 0
|
&& (tm.tm_isdst < 0
|
||||||
|| (isdst != 0) != (tm.tm_isdst != 0)))
|
|| (isdst < 0
|
||||||
|
? dst2 <= (tm.tm_isdst != 0)
|
||||||
|
: (isdst != 0) != (tm.tm_isdst != 0))))
|
||||||
/* We can't possibly find a match, as we are oscillating
|
/* We can't possibly find a match, as we are oscillating
|
||||||
between two values. The requested time probably falls
|
between two values. The requested time probably falls
|
||||||
within a spring-forward gap of size DT. Follow the common
|
within a spring-forward gap of size DT. Follow the common
|
||||||
practice in this case, which is to return a time that is DT
|
practice in this case, which is to return a time that is DT
|
||||||
away from the requested time, preferring a time whose
|
away from the requested time, preferring a time whose
|
||||||
tm_isdst differs from the requested value. In practice,
|
tm_isdst differs from the requested value. (If no tm_isdst
|
||||||
this is more useful than returning -1. */
|
was requested and only one of the two values has a nonzero
|
||||||
|
tm_isdst, prefer that value.) In practice, this is more
|
||||||
|
useful than returning -1. */
|
||||||
break;
|
break;
|
||||||
else if (--remaining_probes == 0)
|
else if (--remaining_probes == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue