summaryrefslogtreecommitdiff
path: root/time/mktime.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-15Fix build failures with -DDEBUG.Martin Sebor
[BZ #19443] * crypt/crypt_util.c [DEBUG] (_ufc_prbits): Correct format string. [DEBUG] (_ufc_set_bits): Declare used. * iconv/gconv_dl.c [DEBUG]: Add a missing include directive. [DEBUG] (print_all): Declare used. * resolv/res_send.c [DEBUG] (__libc_res_nsend): Explicitly convert operands of the ternary ?: expression to target type. * stdlib/rshift.c [DEBUG] (mpn_rshift): Use assert() instead of calling the undeclared abort. * time/mktime.c [DEBUG] (DEBUG): Rename to DEBUG_MKTIME.
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-06-28Sync up mktime with gnulibPaul Eggert
From the gnulib commit log: commit e2646b0c6b5acda25e9ffeb4c12a5513a1e3b5ac Author: Paul Eggert <eggert@cs.ucla.edu> Date: Fri Jun 27 11:35:44 2014 -0700 mktime: merge #if/#ifdef usage from glibc * lib/mktime.c: Use "#if defined DEBUG && DEBUG", not "#if DEBUG", as that works with both Glibc's and Gnulib's style. See thread starting at Siddhesh Poyarekar's bug report at: http://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00102.html
2014-06-27Remove inline keyword from leapyear functionSiddhesh Poyarekar
This syncs up the code with gnulib.
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-02-07Remove lots of inline keywords.Roland McGrath
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-05-23mktime: avoid signed integer overflowPaul Eggert
* time/mktime.c (__mktime_internal): Do not mishandle the case where diff == INT_MIN.
2012-05-23mktime: simplify computation of averagePaul Eggert
* time/mktime.c (ranged_convert): Use new time_t_avg function instead of rolling our own (probably-slower) code.
2012-05-23mktime: do not assume signed right shift propagates sign bitPaul Eggert
* time/mktime.c (isdst_differ): New static function. (__mktime_internal): No need to normalize tm_isdst now. (__mktime_internal, not_equal_tm): Use isdst_differ to compare tm_isdst values.
2012-05-23mktime: merge another wrapv change from gnulibPaul Eggert
* time/mktime.c (TYPE_MAXIMUM): Rework slightly to avoid diagnostics from some compilers.
2012-05-23mktime: remove incorrect attempt at unusual arithmeticsPaul Eggert
* time/mktime.c (TYPE_ONES_COMPLEMENT, TYPE_SIGNED_MAGNITUDE): Remove. The code didn't really work on such machines anyway. (TYPE_MINIMUM): Assume two's complement. (twos_complement_arithmetic): Verify that long_int and time_t are two's complement (or unsigned, in the latter case).
2012-05-23mktime: check signed shifts on long_int and time_t, tooPaul Eggert
* time/mktime.c (SHR): Check that shifts work as desired on the types long_int and time_t too, as SHR is used on such types.
2012-05-23mktime: do not assume 'long' is wide enoughPaul Eggert
* time/mktime.c (verify): Move decl up. (long_int): New type. (leapyear, ydhms_diff, guess_time_tm, __mktime_internal): Use it, to remove assumption in the code that 'long' is wide enough to store year values. This assumption is not true on x32 and on some non-glibc platforms.
2012-05-23mktime: merge wrapv change from gnulibPaul Eggert
* time/mktime.c (WRAPV): New macro. (time_t_avg, time_t_add_ok, time_t_int_add_ok): New static functions. (guess_time_tm, __mktime_internal): Do not assume that signed integer overflow wraps around; modern compilers generate code where this assumption is no longer valid.
2012-05-22Update copyright years for time/mktime.cH.J. Lu
2012-05-22mktime: merge comment-quoting-style change from gnulibPaul Eggert
2012-05-22time/mktime.c (compile-command): Add "-I."Paul Eggert
2012-05-22mktime: merge mktime-internal.h change from gnulibPaul Eggert
2012-05-22mktime: merge time_r change from gnulibPaul Eggert
2012-05-22mktime: merge DEBUG change from gnulibPaul Eggert
2012-05-22mktime: merge <sys/types.h> change from gnulibPaul Eggert
2012-05-22mktime: merge HAVE_CONFIG_H change from gnulibPaul Eggert
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2008-07-06(__mktime_internal): Normalize tp->tm_isdst value.Ulrich Drepper
2007-12-12* time/bug-getdate1.c (do_test): Don't use century values whichUlrich Drepper
aren't valid on 32-bit systems.
2006-09-09[BZ #2821]cvs/fedora-glibc-20060910T1832Ulrich Drepper
* time/mktime.c (guess_time_tm): Fix overflow detection. * time/Makefile (tests): Add bug-mktime1. * time/bug-mktime1.c: New file.
2005-09-08[BZ #1033, BZ #1061]Roland McGrath
2005-07-11 Derek R. Price <derek@ximbiot.com> [BZ #1061] * sysdeps/generic/glob.c (glob): Only a 0 return from getlogin_r means success, according to POSIX 1003.2. 2005-06-23 Paul Eggert <eggert@cs.ucla.edu> [BZ #1033] * time/mktime.c: Import from gnulib. The following macros are now consistent with other gnulib code. This does not change mktime's behavior. (TYPE_IS_INTEGER): New macro. (time_t_is_integer): Use it. (TYPE_TWOS_COMPLEMENT): New macro. (twos_complement_arithmetic): Use it. (TYPE_ONES_COMPLEMENT): New macro. (TYPE_MINIMUM, TYPE_MAXIMUM): Now supports signed-magnitude. mktime doesn't use this, but the code now matches other gnulib code. (ranged_convert): Pacify GCC 4.0 in a different way, which generates a few bytes less code. (ranged_convert, __mktime_internal): When calling a function via a pointer P, use P () rather than (*P) (), as we now assume C89 or better.
2005-06-18* time/mktime.c: Always include <string.h> for prototype ofUlrich Drepper
implicitly used memcpy. * sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c (truncate64): Use __truncate, not truncate. (__have_no_truncate64): Renamed from have_no_truncate64. * sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c (__have_no_truncate64): Renamed from have_no_truncate64.
2005-03-06* posix/regexec.c (check_node_accept_bytes): Correct cast to avoidUlrich Drepper
warning. * posix/regex_internal.c (re_string_reconstruct): Add cast to avoid warning. (build_wcs_upper_buffer): Change type of bug to plain char. * locale/weightwc.h (findidx): Add casts to avoid warnings. * time/mktime.c (ranged_convert): Initialize tm to make the compiler happy. * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Add casts to avoid warnings. * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Add casts to avoid warnings. * wcsmbs/mbsnrtowcs.c: Add casts to avoid warnings. * wcsmbs/wcsrtombs.c (__wcsrtombs): Add casts to avoid warnings. * wcsmbs/wcrtomb.c (__wcrtomb): Add casts to avoid warnings. * wcsmbs/mbrtowc.c (__mbrtowc): Use unsigned char for outbuf. * posix/regex_internal.c [_LIBC] (build_wcs_buffer): Avoid using dynamically sized array. (build_wcs_upper_buffer): Likewise.
2004-12-22(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper
2007-07-122.5-18.1Jakub Jelinek
2004-12-02* time/mktime.c (__mktime_internal): If SEC_REQUESTED != SEC,Roland McGrath
convert T2, not T. * time/Makefile (tests): Add tst-mktime3. * time/tst-mktime3.c: New test. 2004-12-01 Jakub Jelinek <jakub@redhat.com>
2004-11-11[BZ #541]Roland McGrath
2004-11-10 Paul Eggert <eggert@cs.ucla.edu> [BZ #541] * time/mktime.c (SHR): New macro, which is a portable substitute for >> that should work even on Crays. (TIME_T_MIDPOINT, ydhms_diff, __mktime_internal): Use it. Problem reported by Mark D. Baushke in <http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00071.html>.
2004-11-01[BZ #473, BZ #487]Roland McGrath
2004-10-27 Derek R. Price <derek@ximbiot.com> [BZ #487] This change is imported from gnulib. * time/mktime.c (not_equal_tm) [DEBUG]: Remove redundant check. 2004-10-24 Paul Eggert <eggert@cs.ucla.edu> [BZ #473] * time/tst-mktime.c (main): Don't assume that mktime fails when given time stamps before 1970. It returns negative time_t values instead, for compatibility with BSD. * time/tst-mktime2.c: New file. * time/Makefile (tests): Add it. [BZ #473] Import from gnulib. Revamp to avoid several problems near time_t extrema, and on hosts with 64-bit time_t and 32-bit int. This fixes Debian bug 177940. * time/mktime.c (TIME_T_MIDPOINT): New macro. (ydhms_diff): Renamed from ydhms_tm_diff, with a new signature, which avoids overflow problems on hosts with 64-bit time_t and 32-bit int. All callers changed. Now an inline function. Verify at compile-time that long int is wide enough to avoid these overflow problems. (guess_time_tm): New function. (__mktime_internal): Use it. Avoid overflow when computing yday on hosts with 64-bit long and 32-bit int. Remove tests for 69; no longer needed. Use if rather than #ifdef for LEAP_SECONDS_POSSIBLE so that the code is checked by more compilers. Do not rely on floating point to probe: stick to integer arithmetic, to avoid potential porting problems. Repair potential overflow correctly in the Southern Hemisphere. (localtime_offset): Add a FIXME for the case where time_t is unsigned.
2004-10-22[BZ #471] Fix imported from gnulib.Roland McGrath
* time/mktime.c (leapyear, ydms_tm_diff): Year is of type long int, not int, to avoid problems when tm_year == INT_MAX and tm_mon > 12. (__mktime_intenral): Compute year using long int arithmetic, not int arithmetic, to avoid problems on hosts where time_t and long are 64 bits but int is 32.
2004-10-22[BZ #468] Import a fix from gnulib.Roland McGrath
* time/mktime.c [! DEBUG]: Do not include <string.h>. It's needed only if DEBUG is nonzero.
2004-10-22[BZ #470] Import fix from gnulib.Roland McGrath
* time/mktime.c [!_LIBC] (__mktime_internal): Define to mktime_internal, to avoid clashes with any __mktime_internal function defined in the standard library.
2004-10-22[BZ #469] Imported from gnulib.Roland McGrath
* time/mktime.c (__isleap): Remove; all uses replaced by: (leapyear): New function, which avoids overflow by not adding 1900 to year before testing whether it is a leap year.
2004-10-22[BZ #472]Roland McGrath
2004-10-22 Paul Eggert <eggert@cs.ucla.edu> [BZ #472] Imported from gnulib. * time/mktime.c (Local Variables): Remove -DHAVE_TIME_R_POSIX; no longer used.
2004-04-02Update.Ulrich Drepper
* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S: Use __sigprocmask not sigprocmask. * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S: Likewise. * time/mktime.c: Likewise. * misc/getpass.c: Likewise.
2004-01-022003-12-30 Paul Eggert <eggert@twinsun.com>Roland McGrath
* time/mktime.c (verify): New macro. (time_t_is_integer, twos_complement_arithmetic, right_shift_propagates_sign, base_year_is_a_multiple_of_100, C99_integer_division): Document these longstanding assumptions in the code, and verify them at compile-time.
2003-12-31* time/mktime.c: (my_mktime_localtime_r):Roland McGrath
Remove. All uses changed to __localtime_r. (__localtime_r) [!defined _LIBC]: New macro. Include "time_r.h" to get its implementation. Fix compile-command to allow for TIME_R_POSIX. * time/strftime.c (my_strftime_gmtime_r, my_strftime_localtime_r): Remove. All uses changed to __localtime_r and __gmtime_r. (__gmtime_r, __localtime_r) [!HAVE_TM_GMTOFF]: New macros. Include "time_r.h" to get their implementations. * time/timegm.c: Allow use in GNU applications outside glibc. [defined HAVE_CONFIG_H]: Include <config.h>. [!defined _LIBC]: Include "timegm.h", <time_r.h>. Define __gmtime_r, and declare __mktime_internal. (timegm): Define via a prototype, since we can safely assume C89 now.
2003-12-312003-12-30 Paul Eggert <eggert@twinsun.com>Roland McGrath
* time/mktime.c (check_result): Use less-confusing report format. "long" -> "long int", as per usual GNU style. (main): Likewise. Don't loop if the iteration overflows time_t. Allow a negative step in the iteration. * time/mktime.c: Assume freestanding C89 or better. (HAVE_LIMITS_H, STDC_HEADERS) [defined _LIBC]: Remove; assume they're 1. (__P): Remove; not used. (CHAR_BIT, INT_MIN, INT_MAX): Remove; <limits.h> defines them. (mktime, not_equal_tm, print_tm, check_result, main): Use prototypes. Prototypes use const * where appropriate. (main) [DEBUG]: Fix typo in testing code uncovered by above changes, which caused the testing code to dump core on some hosts.
2002-11-24(__mon_yday, __mktime_internal) [!_LIBC]: Declare as `static'.Ulrich Drepper
2002-08-03* include/libc-symbols.h (hidden_weak): Define it for [__ASSEMBLER__].Roland McGrath
* sysdeps/unix/make-syscalls.sh: Generate libc_hidden_def or libc_hidden_weak for every system call symbol defined. * include/time.h: Use libc_hidden_proto for time, asctime, mktime, timelocal, localtime, strftime. * time/asctime.c: Add libc_hidden_def. * time/mktime.c: Likewise. * time/localtime.c: Likewise. * time/strftime.c: Likewise. * time/strptime.c: Likewise. * sysdeps/generic/time.c: Likewise. * sysdeps/unix/time.c: Likewise. * sysdeps/unix/sysv/i386/time.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/time.S: Likewise. * include/arpa/inet.h: Use libc_hidden_proto for inet_ntop, inet_pton. inet_makeaddr, inet_netof, inet_addr, __inet_addr. * resolv/inet_ntop.c: Likewise. * resolv/inet_pton.c: Likewise. * inet/inet_mkadr.c: Add libc_hidden_def. * inet/inet_netof.c: Likewise. * resolv/inet_addr.c: Likewise. * include/libc-symbols.h: Remove `defined HAVE_BROKEN_ALIAS_ATTRIBUTE' clauses from conditionals for now. Will have to be fixed later for older compilers.
2002-04-15Update.Ulrich Drepper
2002-04-14 Jakub Jelinek <jakub@redhat.com> * elf/dl-lookup.c (_dl_lookup_symbol): Move add_dependency call to the end of the function. Pass original flags to recursive call if add_dependency failed. (_dl_lookup_versioned_symbol): Likewise. 2002-04-13 Jakub Jelinek <jakub@redhat.com> * time/mktime.c (__mktime_internal): If year is 69, don't bail out early, but check whether it overflowed afterwards. * time/tst-mktime.c (main): Add new tests. * debug/xtrace.sh: Fix program name in help message. Patch by Roger Luethi <rl@hellgate.ch>.