]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
mktime: simplify offset guess
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 15 Nov 2018 21:59:33 +0000 (22:59 +0100)
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Thu, 15 Nov 2018 21:59:33 +0000 (22:59 +0100)
[BZ#23789]
* time/mktime.c (__mktime_internal): Omit excess precision.

ChangeLog
time/mktime.c

index 6f88de17f4bd9c03d1490d7d0a6654799f6694b1..f70c3be7a1147a1766d89fc9f7b50385d8f2248a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
+       mktime: simplify offset guess
+       [BZ#23789]
+       * time/mktime.c (__mktime_internal): Omit excess precision.
+
        mktime: new test for mktime failure
        [BZ#23789]
        Based on a test suggested by Albert Aribaud in:
index 106b4eac26722b78d002839c209d4782b995caf7..0f905eb8fe6f60391f164c3a13ceb43e6d88573e 100644 (file)
@@ -355,7 +355,7 @@ __mktime_internal (struct tm *tp,
                   struct tm *(*convert) (const time_t *, struct tm *),
                   mktime_offset_t *offset)
 {
-  long_int t, gt, t0, t1, t2, dt;
+  long_int t, gt, t0, t1, t2;
   struct tm tm;
 
   /* The maximum number of probes (calls to CONVERT) should be enough
@@ -502,8 +502,8 @@ __mktime_internal (struct tm *tp,
   /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS.
      This is just a heuristic to speed up the next mktime call, and
      correctness is unaffected if integer overflow occurs here.  */
-  INT_SUBTRACT_WRAPV (t, t0, &dt);
-  INT_SUBTRACT_WRAPV (dt, negative_offset_guess, offset);
+  INT_SUBTRACT_WRAPV (t, t0, offset);
+  INT_SUBTRACT_WRAPV (*offset, negative_offset_guess, offset);
 
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {