[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
time: New module
From: |
Bruno Haible |
Subject: |
time: New module |
Date: |
Wed, 08 Mar 2023 17:18:53 +0100 |
This set of patches introduces a new module 'time', that works around the
inconsistency of time(NULL) with gettimeofday().tv_sec and timespec_get().tv_sec
on glibc systems.
The replacement is a bit slower than the native glibc time(NULL) implementation
— 31 nanoseconds instead of 17 nanoseconds, according to Florian Weimer's
measurements
<https://sourceware.org/pipermail/libc-alpha/2023-March/146133.html>.
The new module is for those GNU programs that prefer to avoid trouble
due to clocks apparently going backwards.
As a bonus, it allows us to fix the test failures of the gettimeofday and
timespec_get tests that occurred with a probability between 0.1% and 0.3%
on glibc/Linux.
2023-03-08 Bruno Haible <bruno@clisp.org>
gettimeofday, timespec_get tests: Avoid test failure on glibc/Linux.
* modules/gettimeofday-tests (Depends-on): Add 'time'.
* modules/timespec_get-tests (Depends-on): Likewise.
* tests/test-gettimeofday.c (test_consistency): Update comment.
* tests/test-timespec_get.c (main): Likewise.
time: Add tests.
* tests/test-time.c: New file.
* modules/time-tests: New file.
time: New module.
* lib/time.in.h (time): New declaration.
* lib/time.c: New file.
* m4/time_h.m4 (gl_TIME_H_REQUIRE_DEFAULTS): Initialize GNULIB_TIME.
(gl_TIME_H_DEFAULTS): Initialize REPLACE_TIME.
* m4/time.m4: New file.
* modules/time-h (Makefile.am): Substitute GNULIB_TIME, REPLACE_TIME.
* modules/time: New file.
* tests/test-time-h-c++.cc: Check the signature of
GNULIB_NAMESPACE::time.
* doc/posix-functions/time.texi: Mention the glibc problem and the
'time' module.
0001-time-New-module.patch
Description: Text Data
0002-time-Add-tests.patch
Description: Text Data
0003-gettimeofday-timespec_get-tests-Avoid-test-failure-o.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- time: New module,
Bruno Haible <=