about summary refs log tree commit diff
path: root/time/mktime.c
Commit message (Collapse)AuthorAgeFilesLines
* Sync up mktime with gnulibPaul Eggert2014-06-281-2/+2
| | | | | | | | | | | | | | | 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
* Remove inline keyword from leapyear functionSiddhesh Poyarekar2014-06-271-1/+1
| | | | This syncs up the code with gnulib.
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Remove lots of inline keywords.Roland McGrath2013-02-071-1/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* mktime: avoid signed integer overflowPaul Eggert2012-05-231-4/+4
| | | | | * time/mktime.c (__mktime_internal): Do not mishandle the case where diff == INT_MIN.
* mktime: simplify computation of averagePaul Eggert2012-05-231-3/+1
| | | | | * time/mktime.c (ranged_convert): Use new time_t_avg function instead of rolling our own (probably-slower) code.
* mktime: do not assume signed right shift propagates sign bitPaul Eggert2012-05-231-6/+12
| | | | | | | * 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.
* mktime: merge another wrapv change from gnulibPaul Eggert2012-05-231-1/+1
| | | | | * time/mktime.c (TYPE_MAXIMUM): Rework slightly to avoid diagnostics from some compilers.
* mktime: remove incorrect attempt at unusual arithmeticsPaul Eggert2012-05-231-9/+6
| | | | | | | | * 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).
* mktime: check signed shifts on long_int and time_t, tooPaul Eggert2012-05-231-3/+5
| | | | | | * 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.
* mktime: do not assume 'long' is wide enoughPaul Eggert2012-05-231-12/+18
| | | | | | | | | * 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.
* mktime: merge wrapv change from gnulibPaul Eggert2012-05-231-25/+90
| | | | | | | | * 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.
* Update copyright years for time/mktime.cH.J. Lu2012-05-221-1/+1
|
* mktime: merge comment-quoting-style change from gnulibPaul Eggert2012-05-221-3/+3
|
* time/mktime.c (compile-command): Add "-I."Paul Eggert2012-05-221-1/+1
|
* mktime: merge mktime-internal.h change from gnulibPaul Eggert2012-05-221-0/+1
|
* mktime: merge time_r change from gnulibPaul Eggert2012-05-221-2/+1
|
* mktime: merge DEBUG change from gnulibPaul Eggert2012-05-221-0/+1
|
* mktime: merge <sys/types.h> change from gnulibPaul Eggert2012-05-221-1/+0
|
* mktime: merge HAVE_CONFIG_H change from gnulibPaul Eggert2012-05-221-1/+1
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* (__mktime_internal): Normalize tp->tm_isdst value.Ulrich Drepper2008-07-061-2/+4
|
* * time/bug-getdate1.c (do_test): Don't use century values whichUlrich Drepper2007-12-121-2/+2
| | | | aren't valid on 32-bit systems.
* [BZ #2821] cvs/fedora-glibc-20060910T1832Ulrich Drepper2006-09-091-5/+6
| | | | | | * time/mktime.c (guess_time_tm): Fix overflow detection. * time/Makefile (tests): Add bug-mktime1. * time/bug-mktime1.c: New file.
* [BZ #1033, BZ #1061]Roland McGrath2005-09-081-20/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * time/mktime.c: Always include <string.h> for prototype ofUlrich Drepper2005-06-181-1/+2
| | | | | | | | | | 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.
* * posix/regexec.c (check_node_accept_bytes): Correct cast to avoidUlrich Drepper2005-03-061-2/+3
| | | | | | | | | | | | | | | | | | | 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.
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-221-48/+25
|
* 2.5-18.1Jakub Jelinek2007-07-121-25/+48
|
* * time/mktime.c (__mktime_internal): If SEC_REQUESTED != SEC,Roland McGrath2004-12-021-1/+2
| | | | | | | | convert T2, not T. * time/Makefile (tests): Add tst-mktime3. * time/tst-mktime3.c: New test. 2004-12-01 Jakub Jelinek <jakub@redhat.com>
* [BZ #541]Roland McGrath2004-11-111-15/+31
| | | | | | | | | | 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>.
* [BZ #473, BZ #487]Roland McGrath2004-11-011-126/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [BZ #471] Fix imported from gnulib.Roland McGrath2004-10-221-3/+4
| | | | | | | | | * 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.
* [BZ #468] Import a fix from gnulib.Roland McGrath2004-10-221-1/+1
| | | | | * time/mktime.c [! DEBUG]: Do not include <string.h>. It's needed only if DEBUG is nonzero.
* [BZ #470] Import fix from gnulib.Roland McGrath2004-10-221-0/+1
| | | | | | * time/mktime.c [!_LIBC] (__mktime_internal): Define to mktime_internal, to avoid clashes with any __mktime_internal function defined in the standard library.
* [BZ #469] Imported from gnulib.Roland McGrath2004-10-221-7/+12
| | | | | | * 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.
* [BZ #472]Roland McGrath2004-10-221-1/+1
| | | | | | | 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.
* Update.Ulrich Drepper2004-04-021-2/+2
| | | | | | | | | | * 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.
* 2003-12-30 Paul Eggert <eggert@twinsun.com>Roland McGrath2004-01-021-1/+14
| | | | | | | | * 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.
* * time/mktime.c: (my_mktime_localtime_r):Roland McGrath2003-12-311-21/+11
| | | | | | | | | | | | | | | | | | 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-30 Paul Eggert <eggert@twinsun.com>Roland McGrath2003-12-311-59/+27
| | | | | | | | | | | | | | | | | * 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.
* (__mon_yday, __mktime_internal) [!_LIBC]: Declare as `static'.Ulrich Drepper2002-11-241-1/+7
|
* * include/libc-symbols.h (hidden_weak): Define it for [__ASSEMBLER__].Roland McGrath2002-08-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Update.Ulrich Drepper2002-04-151-2/+12
| | | | | | | | | | | | | | | | | | 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>.
* Update.Ulrich Drepper2002-04-051-4/+5
| | | | | | | | | | | | | | 2002-04-05 Jakub Jelinek <jakub@redhat.com> * time/mktime.c (__mktime_internal): Move check for year < 70 below all variable declarations. 2002-04-04 Andreas Schwab <schwab@suse.de> * sysdeps/unix/sysv/linux/ia64/pipe.S: Don't overwrite r8 on error. * sysdeps/unix/sysv/linux/x86_64/time.c: Removed. * sysdeps/mips/dec/bits/endian.h: Removed since arch is not supported.
* Update.Ulrich Drepper2002-04-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 2002-04-03 Ulrich Drepper <drepper@redhat.com> * locale/programs/charmap.c (charmap_read): If the charmap doesn't define a code_set_name provide one based on the filename. * malloc/hooks.c: Define weak_variable correctly for _LIBC. 2001-12-28 Andreas Jaeger <aj@suse.de> * time/mktime.c (__mktime_internal): Check for year < 70 [PR libc/2738]. * sysdeps/generic/w_lgamma.c: Initialized local_signgam. * sysdeps/generic/w_lgammaf.c: Likewise. * sysdeps/generic/w_lgammal.c: Likewise [PR libc/2854]. * debug/catchsegv.sh (exval): Quote [ in pattern [PR libc/2902]. Adjust for new output format of the backtrace functions. * misc/syslog.c (vsyslog): Only use cleanup handler if _LIBC_REENTRANT is defined [PR libc/2924]. * sysdeps/s390/s390-64/bits/byteswap.h: Likewise [PR libc/2757].
* Update.Ulrich Drepper2002-02-031-6/+14
| | | | | | | | | 2002-02-02 Paul Eggert <eggert@twinsun.com> * src/mktime.c [defined DEBUG && STDC_HEADERS]: Include <string.h>. (__mktime_internal): If no tm_isdst is requested, prefer solutions with tm_isdst > 0 when the requested time falls within a spring-forward gap [PR libc/2894].
* Update to LGPL v2.1.Andreas Jaeger2001-07-061-8/+8
| | | | | | | | | | | | | | 2001-07-06 Paul Eggert <eggert@twinsun.com> * manual/argp.texi: Remove ignored LGPL copyright notice; it's not appropriate for documentation anyway. * manual/libc-texinfo.sh: "Library General Public License" -> "Lesser General Public License". 2001-07-06 Andreas Jaeger <aj@suse.de> * All files under GPL/LGPL version 2: Place under LGPL version 2.1.
* Update.Ulrich Drepper1999-02-161-1/+2
| | | | | | | | 1999-02-16 Andreas Jaeger <aj@arthur.rhein-neckar.de> * elf/dlfcn.h: Fix typo. * sysdeps/generic/bits/dlfcn.h: Likewise. * sysdeps/mips/bits/dlfcn.h: Likewise.