summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-05 12:26:43 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-05 12:26:43 +0000
commitc00160817df41d1581b2e91620c4adb5cba19a74 (patch)
treee7e6ddc0f298f9bfeae879caca98d760cd284d01 /time
parenta92599eaa0f2564251b794649cd531c6cb3b0bf3 (diff)
downloadglibc-c00160817df41d1581b2e91620c4adb5cba19a74.tar.gz
Update.
1998-11-05 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/fpu/bits/mathinline.h (__pow2): Fix fldl -> fld. * sysdeps/libm-i387/s_fma.S: Optimize a bit. * sysdeps/libm-i387/s_fmaf.S: Likewise. 1998-11-04 19:47 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Search for install-info and substitute it. Determine whether install-info is the buggy Debian version that doesn't understand INFO-DIR-SECTION. * config.make.in: Add INSTALL_INFO and OLD_DEBIAN_INSTALL_INFO to be substituted. * manual/Makefile: If OLD_DEBIAN_INSTALL_INFO, give install-info the --section argument it needs to work properly. (dir-add.texinfo): Delete target. (dir-add.info): Generate this directly. Sort entries. Put a colon at the end of the INFO-DIR-SECTION line. * manual/libc.texinfo: Put a colon at the end of the @dircategory line. 1998-11-05 Paul Eggert <eggert@twinsun.com> * time/mktime.c (__mktime_internal): Adopt the traditional (and problematic) notion of what to do when tm_isdst doesn't match. 1998-11-04 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * posix/PTESTS: Fix spelling. 1998-11-04 Andreas Jaeger <aj@arthur.rhein-neckar.de> * elf/dlopenold.c: Compile only if DO_VERSIONING is also defined. 1998-11-03 H.J. Lu <hjl@gnu.org> * libio/fileops.c (new_do_write): New function. (_IO_new_do_write): Call new_do_write. (_IO_new_file_xsputn): Likewise. * libio/oldfileops.c (old_do_write): New function. (_IO_old_do_write): Call old_do_write. (_IO_old_file_xsputn): Likewise.
Diffstat (limited to 'time')
-rw-r--r--time/mktime.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/time/mktime.c b/time/mktime.c
index 2908db0784..673bb48266 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -350,31 +350,32 @@ __mktime_internal (tp, convert, offset)
/* If we have a match, check whether tm.tm_isdst has the requested
value, if any. */
- if (dt == 0 && 0 <= isdst && 0 <= tm.tm_isdst)
+ if (dt == 0 && isdst != tm.tm_isdst && 0 <= isdst && 0 <= tm.tm_isdst)
{
- int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
- if (dst_diff)
+ /* tm.tm_isdst has the wrong value. Look for a neighboring
+ time with the right value, and use its UTC offset.
+ Heuristic: probe the previous three calendar quarters (approximately),
+ looking for the desired isdst. This isn't perfect,
+ but it's good enough in practice. */
+ int quarter = 7889238; /* seconds per average 1/4 Gregorian year */
+ int i;
+
+ /* If we're too close to the time_t limit, look in future quarters. */
+ if (t < TIME_T_MIN + 3 * quarter)
+ quarter = -quarter;
+
+ for (i = 1; i <= 3; i++)
{
- /* Move two hours in the direction indicated by the disagreement,
- probe some more, and switch to a new time if found.
- The largest known fallback due to daylight savings is two hours:
- once, in Newfoundland, 1988-10-30 02:00 -> 00:00. */
- time_t ot = t - 2 * 60 * 60 * dst_diff;
- while (--remaining_probes != 0)
+ time_t ot = t - i * quarter;
+ struct tm otm;
+ ranged_convert (convert, &ot, &otm);
+ if (otm.tm_isdst == isdst)
{
- struct tm otm;
- dt = ydhms_tm_diff (year, yday, hour, min, sec,
- ranged_convert (convert, &ot, &otm));
- if (dt == 0
- || (ot + dt == t
- && dst_diff == (isdst != 0) - (tm.tm_isdst != 0)))
- {
- t = ot;
- tm = otm;
- break;
- }
- if ((ot += dt) == t)
- break; /* Avoid a redundant probe. */
+ /* We found the desired tm_isdst.
+ Extrapolate back to the desired time. */
+ t = ot + ydhms_tm_diff (year, yday, hour, min, sec, &otm);
+ ranged_convert (convert, &t, &tm);
+ break;
}
}
}