summary refs log tree commit diff
path: root/time
Commit message (Collapse)AuthorAgeFilesLines
* Declare timegm for ISO C2XJoseph Myers2022-06-061-5/+14
| | | | | | | | The next revision of the ISO C standard has added the timegm function (that was already supported in glibc). Update the feature test conditionals on its declaration in <time.h> accordingly. Tested for x86_64.
* locale: Remove private union from struct __locale_dataFlorian Weimer2022-05-233-54/+45
| | | | | | | This avoids an alias violation later. This commit also fixes an incorrect double-checked locking idiom in _nl_init_era_entries. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* locale: Remove cleanup function pointer from struct __localedataFlorian Weimer2022-05-233-4/+0
| | | | | | | We can call the cleanup functions directly from _nl_unload_locale if we pass the category to it. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* clock_settime/clock_gettime: Use __nonnull to avoid null pointerXiaoming Ni2022-05-051-4/+7
| | | | | | | | | | | | | clock_settime() clock_settime64() clock_gettime() clock_gettime64() Add __nonnull((2)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-0167-67/+67
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* timezone: handle truncated timezones from tzcode-2021d and later (BZ #28707)Hans-Peter Nilsson2021-12-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using a timezone file with a truncated starting time, generated by the zic in IANA tzcode-2021d a.k.a. tzlib-2021d (also in tzlib-2021e; current as of this writing), glibc asserts in __tzfile_read (on e.g. tzset() for this file) and you may find lines matching "tzfile.c:435: __tzfile_read: Assertion `num_types == 1' failed" in your syslog. One example of such a file is the tzfile for Asuncion generated by tzlib-2021e as follows, using the tzlib-2021e zic: "zic -d DEST -r @1546300800 -L /dev/null -b slim SOURCE/southamerica". Note that in its type 2 header, it has two entries in its "time-types" array (types), but only one entry in its "transition types" array (type_idxs). This is valid and expected already in the published RFC8536, and not even frowned upon: "Local time for timestamps before the first transition is specified by the first time type (time type 0)" ... "every nonzero local time type index SHOULD appear at least once in the transition type array". Note the "nonzero ... index". Until the 2021d zic, index 0 has been shared by the first valid transition but with 2021d it's separate, set apart as a placeholder and only "implicitly" indexed. (A draft update of the RFC mandates that the entry at index 0 is a placeholder in this case, hence can no longer be shared.) * time/tzfile.c (__tzfile_read): Don't assert when no transitions are found. Co-authored-by: Christopher Wong <Christopher.Wong@axis.com>
* Fix subscript error with odd TZif file [BZ #28338]Paul Eggert2021-10-071-2/+1
| | | | | | | | * time/tzfile.c (__tzfile_compute): Fix unlikely off-by-one bug that accessed before start of an array when an oddball-but-valid TZif file was queried with an unusual time_t value. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* time: Ignore interval nanoseconds on tst-itimerAdhemerval Zanella2021-10-041-9/+10
| | | | | | | | | | | | | Running the test on a 4.4 kernel within KVM, the precision used on ITIMER_VIRTUAL and ITIMER_PROF seems to different than the one used for ITIMER_REAL (it seems the same used for CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE). I did not see it on other kernels, for instance 5.11 and 4.15. To avoid trying to guess the resolution used, do not check the nanosecond internal values for the specific timers. Checked on i686-linux-gnu with a 4.4 kernel.
* time: Fix compile error in itimer test affecting hurdStafford Horne2021-09-161-2/+3
| | | | | | | | | | | | | | | | | | | | | The recent change to use __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 to avoid doing 64-bit checks on some platforms broke the test for hurd where __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 is not defined. With error: tst-itimer.c: In function 'do_test': tst-itimer.c:103:11: error: '__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64' undeclared (first use in this function) 103 | if (__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tst-itimer.c:103:11: note: each undeclared identifier is reported only once for each function it appears in Define a support helper to detect when setitimer and getitimer support 64-bit time_t. Fixes commit 6e8a0aac2f ("time: Fix overflow itimer tests on 32-bit systems"). Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org> Cc: Joseph Myers <joseph@codesourcery.com>
* Remove "Contributed by" linesSiddhesh Poyarekar2021-09-036-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* time: Fix overflow itimer tests on 32-bit systemsStafford Horne2021-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | On the port of OpenRISC I am working on and it appears the rv32 port we have sets __TIMESIZE == 64 && __WORDSIZE == 32. This causes the size of time_t to be 8 bytes, but the tv_sec in the kernel is still 32-bit causing truncation. The truncations are unavoidable on these systems so skip the testing/failures by guarding with __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64. Also, futher in the tests and in other parts of code checking for time_t overflow does not work on 32-bit systems when time_t is 64-bit. As suggested by Adhemerval, update the in_time_t_range function to assume 32-bits by using int32_t. This also brings in the header for stdint.h so we can update other usages of __int32_t to int32_t as suggested by Adhemerval. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Cleanups after librt moveFlorian Weimer2021-06-281-6/+0
| | | | | | | | | | | | librt.so is no longer installed for PTHREAD_IN_LIBC, and tests are not linked against it. $(librt) is introduced globally for shared tests that need to be linked for both PTHREAD_IN_LIBC and !PTHREAD_IN_LIBC. GLIBC_PRIVATE symbols that were needed during the transition are removed again. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Only use 64-bit syscall if required for clock_nanosleepAdhemerval Zanella2021-06-222-15/+34
| | | | | | | | | | | For !__ASSUME_TIME64_SYSCALLS there is no need to issue a 64-bit syscall if the provided timeout fits in a 32-bit one. The 64-bit usage should be rare since the timeout is a relative one. Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel (with and without --enable-kernel=5.1) and on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Use 64 bit time_t stat internallyAdhemerval Zanella2021-06-221-3/+3
| | | | | | | | | | For the legacy ABI with supports 32-bit time_t it calls the 64-bit time directly, since the LFS symbols calls the 64-bit time_t ones internally. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* y2038: Add test coverageAdhemerval Zanella2021-06-1519-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is enabled through a new rule, tests-y2038, which is built only when the ABI supports the comapt 64-bit time_t (defined by the header time64-compat.h, which also enables the creation of the symbol Version for Linux). It means the tests are not built for ABI which already provide default 64-bit time_t. The new rule already adds the required LFS and 64-bit time_t compiler flags. The current coverage is: * libc: - adjtime tst-adjtime-time64 - adjtimex tst-adjtimex-time64 - clock_adjtime tst-clock_adjtime-time64 - clock_getres tst-clock-time64, tst-cpuclock1-time64 - clock_gettime tst-clock-time64, tst-clock2-time64, tst-cpuclock1-time64 - clock_nanosleep tst-clock_nanosleep-time64, tst-cpuclock1-time64 - clock_settime tst-clock2-time64 - cnd_timedwait tst-cnd-timedwait-time64 - ctime tst-ctime-time64 - ctime_r tst-ctime-time64 - difftime tst-difftime-time64 - fstat tst-stat-time64 - fstatat tst-stat-time64 - futimens tst-futimens-time64 - futimes tst-futimes-time64 - futimesat tst-futimesat-time64 - fts_* tst-fts-time64 - getitimer tst-itimer-timer64 - getrusage - gettimeofday tst-clock_nanosleep-time64 - glob / globfree tst-gnuglob64-time64 - gmtime tst-gmtime-time64 - gmtime_r tst-gmtime-time64 - lstat tst-stat-time64 - localtime tst-y2039-time64 - localtime_t tst-y2039-time64 - lutimes tst-lutimes-time64 - mktime tst-mktime4-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - msgctl test-sysvmsg-time64 - mtx_timedlock tst-mtx-timedlock-time64 - nanosleep tst-cpuclock{12}-time64, tst-mqueue8-time64, tst-clock-time64 - nftw / ftw ftwtest-time64 - ntp_adjtime tst-ntp_adjtime-time64 - ntp_gettime tst-ntp_gettime-time64 - ntp_gettimex tst-ntp_gettimex-time64 - ppoll tst-ppoll-time64 - pselect tst-pselect-time64 - pthread_clockjoin_np tst-join14-time64 - pthread_cond_clockwait tst-cond11-time64 - pthread_cond_timedwait tst-abstime-time64 - pthread_mutex_clocklock tst-abstime-time64 - pthread_mutex_timedlock tst-abstime-time64 - pthread_rwlock_clockrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_clockwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedrdlock tst-abstime-time64, tst-rwlock14-time64 - pthread_rwlock_timedwrlock tst-abstime-time64, tst-rwlock14-time64 - pthread_timedjoin_np tst-join14-time64 - recvmmsg tst-cancel4_2-time64 - sched_rr_get_interval tst-sched_rr_get_interval-time64 - select tst-select-time64 - sem_clockwait tst-sem5-time64 - sem_timedwait tst-sem5-time64 - semctl test-sysvsem-time64 - semtimedop test-sysvsem-time64 - setitimer tst-mqueue2-time64, tst-itimer-timer64 - settimeofday tst-settimeofday-time64 - shmctl test-sysvshm-time64 - sigtimedwait tst-sigtimedwait-time64 - stat tst-stat-time64 - thrd_sleep tst-thrd-sleep-time64 - time tst-mqueue{1248}-time64 - timegm tst-timegm-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 - timerfd_gettime tst-timerfd-time64 - timerfd_settime tst-timerfd-time64 - timespec_get tst-timespec_get-time64 - timespec_getres tst-timespec_getres-time64 - utime tst-utime-time64 - utimensat tst-utimensat-time64 - utimes tst-utimes-time64 - wait3 tst-wait3-time64 - wait4 tst-wait4-time64 * librt: - aio_suspend tst-aio6-time64 - mq_timedreceive tst-mqueue{1248}-time64 - mq_timedsend tst-mqueue{1248}-time64 - timer_gettime tst-timer4-time64 - timer_settime tst-timer4-time64 * libanl: - gai_suspend Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add support for 64-bit time on legacy ABIsAdhemerval Zanella2021-06-152-3/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new build flag, _TIME_BITS, enables the usage of the newer 64-bit time symbols for legacy ABI (where 32-bit time_t is default). The 64 bit time support is only enabled if LFS (_FILE_OFFSET_BITS=64) is also used. Different than LFS support, the y2038 symbols are added only for the required ABIs (armhf, csky, hppa, i386, m68k, microblaze, mips32, mips64-n32, nios2, powerpc32, sparc32, s390-32, and sh). The ABIs with 64-bit time support are unchanged, both for symbol and types redirection. On Linux the full 64-bit time support requires a minimum of kernel version v5.1. Otherwise, the 32-bit fallbacks are used and might results in error with overflow return code (EOVERFLOW). The i686-gnu does not yet support 64-bit time. This patch exports following rediretions to support 64-bit time: * libc: adjtime adjtimex clock_adjtime clock_getres clock_gettime clock_nanosleep clock_settime cnd_timedwait ctime ctime_r difftime fstat fstatat futimens futimes futimesat getitimer getrusage gettimeofday gmtime gmtime_r localtime localtime_r lstat_time lutimes mktime msgctl mtx_timedlock nanosleep nanosleep ntp_gettime ntp_gettimex ppoll pselec pselect pthread_clockjoin_np pthread_cond_clockwait pthread_cond_timedwait pthread_mutex_clocklock pthread_mutex_timedlock pthread_rwlock_clockrdlock pthread_rwlock_clockwrlock pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock pthread_timedjoin_np recvmmsg sched_rr_get_interval select sem_clockwait semctl semtimedop sem_timedwait setitimer settimeofday shmctl sigtimedwait stat thrd_sleep time timegm timerfd_gettime timerfd_settime timespec_get utime utimensat utimes utimes wait3 wait4 * librt: aio_suspend mq_timedreceive mq_timedsend timer_gettime timer_settime * libanl: gai_suspend Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* time: Add 64-bit time support for getdateAdhemerval Zanella2021-06-152-22/+14
| | | | | | | | | | | | The getdate is basically a wrapper localtime and mktime. The 64-bit time support is done calling the 64-bit internal functions, there is no need to add a new symbol version. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for struct timespecAdhemerval Zanella2021-06-151-1/+6
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for struct timevalAdhemerval Zanella2021-06-151-0/+5
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* y2038: Add __USE_TIME_BITS64 support for time_tAdhemerval Zanella2021-06-151-0/+4
| | | | | | | | The __USE_TIME_BITS64 is not defined internally yet. Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Do not declare asctime_r and ctime_r for C2XJoseph Myers2021-05-181-2/+2
| | | | | | | | | | | | | | | | | ISO C2X added the asctime_r, ctime_r, gmtime_r and localtime_r functions from POSIX. It's now removed asctime_r and ctime_r again, reflecting that they are marked obsolescent in POSIX; update glibc's time.h accordingly. The same change that removed those two functions from C2X also marked asctime and ctime as deprecated (reflecting how POSIX shows them as obsolescent), i.e. using the [[deprecated]] attribute in the prototypes shown in C2X. It's less clear if we should explicitly deprecate those functions like that in the glibc headers; this patch does nothing regarding such a deprecation (there's no normative requirement from C2X showing the functions as deprecated). Tested for x86_64 and x86.
* Add C2X timespec_getresJoseph Myers2021-05-176-2/+96
| | | | | | | | | | | | | | | | | | | ISO C2X adds a timespec_getres function alongside the C11 timespec_get, with functionality similar to that of POSIX clock_getres (including allowing a NULL pointer to be passed to the function). Implement this function for glibc, similarly to the implementation of timespec_get. This includes a basic test like that of timespec_get, but no documentation in the manual, given that TIME_UTC and timespec_get aren't documented in the manual at all. The handling of 64-bit time follows that in timespec_get; people maintaining patch series for 64-bit time will need to update them accordingly (to export __timespec_getres64, redirect calls in time.h and run the test for _TIME_BITS=64). Tested for x86_64 and x86, and (previous version; only testcase differs) with build-many-glibcs.py.
* time: Add 64 bit tests for getdate / getdate_rAdhemerval Zanella2021-04-151-61/+92
| | | | | | | | The test is also converted to use libsupport. Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* time: Add basic timespec_get testsAdhemerval Zanella2021-04-152-1/+42
| | | | | | Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* time: Add timegm/timelocal basic testsAdhemerval Zanella2021-04-152-1/+96
| | | | | | Checked i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* time: Add gmtime/gmtime_r testsAdhemerval Zanella2021-04-152-1/+125
| | | | | | Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* time: Add getitimer and setitimer basic testsAdhemerval Zanella2021-04-152-1/+176
| | | | | | Checked on i686-linux-gnu and x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Support for multiple versions in versioned_symbol, compat_symbolFlorian Weimer2021-03-255-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This essentially folds compat_symbol_unique functionality into compat_symbol. This change eliminates the need for intermediate aliases for defining multiple symbol versions, for both compat_symbol and versioned_symbol. Some binutils versions do not suport multiple versions per symbol on some targets, so aliases are automatically introduced, similar to what compat_symbol_unique did. To reduce symbol table sizes, a configure check is added to avoid these aliases if they are not needed. The new mechanism works with data symbols as well as function symbols, due to the way an assembler-level redirect is used. It is not compatible with weak symbols for old binutils versions, which is why the definition of __malloc_initialize_hook had to be changed. This is not a loss of functionality because weak symbols do not matter to dynamic linking. The placeholder symbol needs repeating in nptl/libpthread-compat.c now that compat_symbol is used, but that seems more obvious than introducing yet another macro. A subtle difference was that compat_symbol_unique made the symbol global automatically. compat_symbol does not do this, so static had to be removed from the definition of __libpthread_version_placeholder. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for settimeofdayLukasz Majewski2021-03-082-1/+57
| | | | | | | | | | | | This code brings test to check if time on target machine is properly set. To avoid any issues with altering the time: - The time, which was set before the test was executed is restored. - The time is altered only when cross-test-ssh.sh is executed with --allow-time-setting flag Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for clock_settimeLukasz Majewski2021-03-082-1/+46
| | | | | | | | | | | | This code brings test to check if time on target machine is properly set. To avoid any issues with altering the time: - The time, which was set before the test was executed is restored. - The time is altered only when cross-test-ssh.sh is executed with --allow-time-setting flag Reviewed-by: DJ Delorie <dj@redhat.com>
* tst: time: Provide Y2038 tests for mktime (tst-mktime4.c)Lukasz Majewski2021-02-162-1/+110
| | | | | | | | | | | | | This change adds new test to assess mktime's functionality. To be more specific - following use cases are checked: - Pass struct tm as epoch time - Pass struct tm as value just before Y2038 threshold (returned value shall be 0x7FFFFFFF) - Pass struct tm as the first value after Y2038 threshold (expected value - 0x80000000) Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Provide test for difftimeLukasz Majewski2021-02-162-1/+57
| | | | | | | | | | | This change adds new test to assess difftime's functionality by adding some arbitrary offsets to current time_t value (read via time). If 64 bit time_t is supported, the same procedure is applied around the threshold of Y2038 time overflow. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Provide test for ctimeLukasz Majewski2021-02-162-1/+57
| | | | | | | | | | | This change adds new test to assess ctime's functionality. To be more specific - following use cases are checked: - Pass time_t value as 0 to check if epoch time is converted - Pass time_t as max value for 32 bit systems - Pass time_t as the first value after Y2038 threshold Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-0256-56/+56
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* linux: Allow adjtime with NULL argument [BZ #26833]Adhemerval Zanella2020-11-092-1/+46
| | | | | | | | | | | The adjtime interface allows return the amount of time remaining from any previous adjustment that has not yet been completed by passing a NULL as first argument. This was introduced with y2038 support 0308077e3a. Checked on i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Hurd: Fix ftime buildAdhemerval Zanella2020-10-271-25/+4
| | | | | | | | It does not provide __clock_gettime64, the ftime y2038 support is moved to a Linux specific implementation. Checked with a build for i686-linux-gnu and on x86_64-linux and i686-linux-gnu.
* time: Add 64-bit time_t support for ftimeAdhemerval Zanella2020-10-274-16/+41
| | | | | | | | | It basically calls the 64-bit __clock_gettime64 and adds the overflow check. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Reinstate ftime and add deprecate message on ftime usageAdhemerval Zanella2020-10-274-45/+63
| | | | | | | This patch revert "Move ftime to a compatibility symbol" (commit 14633d3e568eb9770a7e5046eff257113e0453fb). Checked on x86_64-linux-gnu and i686-linux-gnu.
* Remove timing related checks of time/tst-cpuclock1Stefan Liebler2020-10-261-59/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with the commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f "Fix time/tst-cpuclock1 intermitent failures" (2020-07-11), this test fails quite often on s390x/s390 with one/multiple of those: "before - after" / "nanosleep time" / "dead - after" ourside reasonable range. On a zVM/kvm guest the CPUs are shared between multiple guests. And even on the lpar (kvm host) the CPUs are usually shared between multiple lpars. The defined CPUs for a lpar/zVM-system could also have lower weights compared to other lpars which let the steal time further grow. Usually I build (-j$(nproc)) and test (PARALLELMFLAGS="-j$(nproc)") glibc multiple times, e.g. with different GCCs, on various lpars or zVM guests at the same time. During this time, I've run the test for 13500 times and obvserved the following fails: ~600x "before - after" ~60x "nanosleep time" ~70x "dead - after" I've also observed a lot of "before - after" fails on a intel kvm-guest while building/testing glibc on it. The mentioned commit has tighten the limits of valid tv_nsec ranges: "before - after" (expected: 500000000): - 100000000 ... 600000000 + 450000000 ... 550000000 "nanosleep time" (expected: 100000000): - 100000000 ... 200000000 + 090000000 ... 120000000 "dead - after" (expected: 100000000): - ... 200000000 + 090000000 ... 120000000 The test itself forks a child process which chew_cpu (user- and kernel-space). The parent process sleeps with nanosleep(0.5s) and measures the child_clock time: diff = after - before With much workload on the machine, the child won't make much progess and it can fall much beyond the minimum limit. Afterwards the parent process sleeps with clock_nanosleep (child_clock, 0.1s): diff = afterns - after The test currently also allows 0.9 * 0.1s which would be an error. Depending on the workload, the maximum limit can exceed the 1.2 * 0.1s. For "dead - after", the parent process kills the child process and waits long enough to let the child finish dying. Then it gets the time of the child: diff = dead - after Note that diff also contains the time for the previous clock_nanosleep. Thus you'll often see both fails at the same time. After discussion on the mailing list, we've decided to keep the functional checks for the clock* functions and remove the timing related checks as those are prone to false positives. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Move ftime to a compatibility symbolAdhemerval Zanella2020-10-164-77/+50
| | | | | | | | | | It was made deprecated on 2.31, so it moves to compat symbol after two releases. It was also removed from exported symbol for riscv32 (since ABI will be supported on for 2.33). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Remove internal usage of extensible stat functionsAdhemerval Zanella2020-09-112-3/+3
| | | | | | | | | | | | It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Sync mktime.c from GnulibPaul Eggert2020-08-041-3/+3
| | | | | * time/mktime.c: Sync from Gnulib. This micro-optimizes three division-related computations.
* Fix time/tst-cpuclock1 intermitent failuresLucas A. M. Magalhaes2020-07-101-30/+22
| | | | | | | | | | | | | | This test fails intermittently in systems with heavy load as CLOCK_PROCESS_CPUTIME_ID is subject to scheduler pressure. Thus the test boundaries were relaxed to keep it from failing on such systems. A refactor of the spent time checking was made with some support functions. With the advantage to representing time jitter in percent of the target. The values used by the test boundaries are all empirical. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update timezone code from tzcode 2020aPaul Eggert2020-05-151-1/+1
| | | | | | | | | | | This patch updates files coming from tzcode to tzcode 2020a. This is mostly for better support for Internet RFC 8536, by adding support to zic for the Expires line (new to tzcode 2020a), the -b option (new to 2019b) and the -r option (new to 2019a). One trivial change to other glibc was needed. * time/tzfile.c (__tzfile_read): Adjust to tzcode private.h renaming. * timezone/private.h, timezone/tzfile.h, timezone/version: * timezone/zdump.c, timezone/zic.c: Update from tzcode 2020a.
* y2038: Export __clock_gettime64 to be usable in other librariesLukasz Majewski2020-05-051-0/+1
| | | | | | | In the glibc project calls to clock_gettime shall be replaced with __clock_gettime64, which is supporting 64 bit time. To allow that the __clock_gettime64 needs to be exported as a GLIBC_PRIVATE symbol.
* alpha: Fix static gettimeofday symbolAdhemerval Zanella2020-02-131-1/+3
| | | | | | | | By undef strong_alias on alpha implementation, the default_symbol_version macro becomes an empty macro on static build. It fixes the issue introduced at c953219420. Checked on alpha-linux-gnu with a 'make check run-built-tests=no'.
* alpha: Use generic gettimeofday implementationAdhemerval Zanella2020-02-121-6/+0
| | | | | | | | | It makes alpha no longer reports information about a system-wide time zone and moves the version logic on the alpha implementation. Checked on a build and check-abi for alpha-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-0155-55/+55
|
* Declare asctime_r, ctime_r, gmtime_r, localtime_r for C2X.Joseph Myers2019-11-111-4/+4
| | | | | | | | C2X adds the asctime_r, ctime_r, gmtime_r and localtime_r functions. This patch duly adds __GLIBC_USE (ISOC2X) to the conditions under which <time.h> declares them. Tested for x86_64.
* Refactor nanosleep in terms of clock_nanosleepAdhemerval Zanella2019-11-061-1/+1
| | | | | | | | | | | | | The generic version is straightforward. For Hurd, its nanosleep implementation is moved to clock_nanosleep with adjustments from generic unix implementation. The generic clock_nanosleep unix version is also removed since it calls nanosleep. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>