mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 09:43:32 +08:00
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.
This commit is contained in:
parent
8e6fd2bdb2
commit
e1080e7e5f
10
ChangeLog
10
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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
/* Gnulib mktime-internal.h, tailored for glibc. */
|
||||
typedef time_t mktime_offset_t;
|
||||
typedef long int mktime_offset_t;
|
||||
|
Loading…
Reference in New Issue
Block a user