]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix mktime localtime offset confusion
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 19 Sep 2018 20:16:14 +0000 (13:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 20 Sep 2018 00:09:08 +0000 (17:09 -0700)
[BZ #23603]
* include/time.h (__mktime_internal): The localtime offset is now
of type long int instead of time_t.  This is the longstanding type
in glibc, and it is more than enough to represent difference
between localtime and gmtime even if it is 32 bits and time_t is
64.  Changing it now will let us avoid an unnecessary change when
time_t is widened to 64 bits on 32-bit platforms.
* time/mktime-internal.h (mktime_offset_t): Now long int.

ChangeLog
include/time.h
time/mktime-internal.h

index a49dba34eacf787e261ccc237120e274ab806954..e15ac3bdb1286429884344a75785705f2ed798a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2018-09-19  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Fix mktime localtime offset confusion
+       [BZ #23603]
+       * include/time.h (__mktime_internal): The localtime offset is now
+       of type long int instead of time_t.  This is the longstanding type
+       in glibc, and it is more than enough to represent difference
+       between localtime and gmtime even if it is 32 bits and time_t is
+       64.  Changing it now will let us avoid an unnecessary change when
+       time_t is widened to 64 bits on 32-bit platforms.
+       * time/mktime-internal.h (mktime_offset_t): Now long int.
+
        Merge mktime, timegm from upstream Gnulib
        [BZ #23603][BZ #16346]
        This fixes some obscure problems with integer overflow.
index 23d2580528b024902d776c0ce5611bc2248a63ec..e30c5fc3b1d13732bf68077b59bcecafbefe0886 100644 (file)
@@ -55,11 +55,11 @@ extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
 
 /* Subroutine of `mktime'.  Return the `time_t' representation of TP and
    normalize TP, given that a `struct tm *' maps to a `time_t' as performed
-   by FUNC.  Keep track of next guess for time_t offset in *OFFSET.  */
+   by FUNC.  Record next guess for localtime-gmtime offset in *OFFSET.  */
 extern time_t __mktime_internal (struct tm *__tp,
                                 struct tm *(*__func) (const time_t *,
                                                       struct tm *),
-                                time_t *__offset) attribute_hidden;
+                                long int *__offset) attribute_hidden;
 extern struct tm *__localtime_r (const time_t *__timer,
                                 struct tm *__tp) attribute_hidden;
 
index 01671285fce37d7f025f6533b46189f973c48939..6111c22880fb84a4a4ec3d26f5512b1a032881da 100644 (file)
@@ -1,2 +1,2 @@
 /* Gnulib mktime-internal.h, tailored for glibc.  */
-typedef time_t mktime_offset_t;
+typedef long int mktime_offset_t;