about summary refs log tree commit diff
path: root/time/mktime.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Update.Ulrich Drepper1999-02-161-42/+27
| | | | | * time/mktime.c: Use ISO C form for function definitions and remove unnecessary prototypes.
* Update.Ulrich Drepper1998-11-081-34/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1998-11-05 1998 H.J. Lu <hjl@gnu.org> * libio/iofgets.c (_IO_fgets): Don't report error if something was read in and errno is set to EAGAIN. * libio/iofgets_u.c (fgets_unlocked): Likewise. 1998-11-05 Philip Blundell <philb@gnu.org> * sysdeps/unix/sysv/linux/net/if_packet.h: Don't include kernel header; it defines too much. Provide a local definition of struct sockaddr_pkt and a comment advising against its use. 1998-11-06 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * extra-lib.mk: Avoid empty include list. 1998-11-04 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * extra-lib.mk: Add support for $(lib)-shared-only-routines. * elf/Makefile (libdl-routines): Add dlopenold only if doing versioning. (libdl-shared-only-routines): New variable. 1998-11-06 Paul Eggert <eggert@twinsun.com> Don't invoke localtime_r or gmtime_r unless it's the GNU C library's localtime_r and gmtime_r; there are too many buggy implementations of localtime_r and gmtime_r out there, and it's not worth keeping track of all the different bugs. * time/mktime.c (__EXTENSIONS__): Remove. (<unistd.h>): No need to include. * time/strftime.c: Likewise. * time/mktime.c (_POSIX_THREAD_SAFE_FUNCTIONS, HAVE_LOCALTIME_R): Remove. (my_mktime_localtime_r): Renamed from localtime_r; all uses changed. Base it on localtime unless _LIBC. * time/strftime.c (my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed. (my_strftime_localtime_r): Renamed from localtime_r; all uses changed. Base them on localtime/gmtime if not _LIBC. 1998-11-07 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/isastream.c: Always return 0 unless it is an invalid file descriptor. This makes this function actually usable. Proposed by Mark Kettenis <kettenis@phys.uva.nl>.
* Update.Ulrich Drepper1998-11-051-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1998-11-05 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/fpu/bits/mathinline.h (__pow2): Fix fldl -> fld. * sysdeps/libm-i387/s_fma.S: Optimize a bit. * sysdeps/libm-i387/s_fmaf.S: Likewise. 1998-11-04 19:47 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Search for install-info and substitute it. Determine whether install-info is the buggy Debian version that doesn't understand INFO-DIR-SECTION. * config.make.in: Add INSTALL_INFO and OLD_DEBIAN_INSTALL_INFO to be substituted. * manual/Makefile: If OLD_DEBIAN_INSTALL_INFO, give install-info the --section argument it needs to work properly. (dir-add.texinfo): Delete target. (dir-add.info): Generate this directly. Sort entries. Put a colon at the end of the INFO-DIR-SECTION line. * manual/libc.texinfo: Put a colon at the end of the @dircategory line. 1998-11-05 Paul Eggert <eggert@twinsun.com> * time/mktime.c (__mktime_internal): Adopt the traditional (and problematic) notion of what to do when tm_isdst doesn't match. 1998-11-04 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * posix/PTESTS: Fix spelling. 1998-11-04 Andreas Jaeger <aj@arthur.rhein-neckar.de> * elf/dlopenold.c: Compile only if DO_VERSIONING is also defined. 1998-11-03 H.J. Lu <hjl@gnu.org> * libio/fileops.c (new_do_write): New function. (_IO_new_do_write): Call new_do_write. (_IO_new_file_xsputn): Likewise. * libio/oldfileops.c (old_do_write): New function. (_IO_old_do_write): Call old_do_write. (_IO_old_file_xsputn): Likewise.
* Update.Ulrich Drepper1998-11-041-28/+16
| | | | | | * time/mktime.c (__mktime_internal): Correct last change. We must stop searching for the right isdst value before stepping to the initial value.
* Update.Ulrich Drepper1998-11-031-12/+27
| | | | | | | | | | | | | | | | | | | | | | 1998-11-03 Ulrich Drepper <drepper@cygnus.com> * time/mktime.c (__mktime_internal): Handle broken down times around the time of the DST switches more correctly. 1998-11-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/netatalk/at.h: Include <linux/atalk.h> before <sys/socket.h> to make sockaddr_at available to <sys/socket.h>. 1998-11-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * time/tzset.c (tz_compute): Remove unused parameter timer. Change caller. 1998-11-02 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/generic/bits/types.h (__ipc_pid_t): New typedef.