]> Savannah Git Hosting - gnulib.git/commitdiff
time: Fix test failure on native Windows.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 12:31:11 +0000 (13:31 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 12:31:11 +0000 (13:31 +0100)
* m4/time.m4 (gl_FUNC_TIME): Guess that it does not work on native
Windows.
* modules/time (Depends-on): Add gettimeofday.
* doc/posix-functions/time.texi: Mention the bug on Windows.

ChangeLog
doc/posix-functions/time.texi
m4/time.m4
modules/time

index 816190dbc968b9f74446c4a20a8e3663f9c97f60..3249000a4dc8d876405ce2882f6e71a0d40ff0b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-03-17  Bruno Haible  <bruno@clisp.org>
+
+       time: Fix test failure on native Windows.
+       * m4/time.m4 (gl_FUNC_TIME): Guess that it does not work on native
+       Windows.
+       * modules/time (Depends-on): Add gettimeofday.
+       * doc/posix-functions/time.texi: Mention the bug on Windows.
+
 2023-03-17  Bruno Haible  <bruno@clisp.org>
 
        vasnprintf, vasnwprintf: Include all necessary workarounds in libintl.
index a8e9abcddf0acdae3562adc6ab591b2d2d16118d..5d7c719594358da5232e1842b70caba91092e8a1 100644 (file)
@@ -12,10 +12,11 @@ Portability problems fixed by Gnulib:
 This function is not consistent with @code{gettimeofday} and @code{timespec_get}
 on some platforms:
 @c https://sourceware.org/bugzilla/show_bug.cgi?id=30200
-glibc 2.31 or newer on Linux.
-Namely, in the first 1 to 2.5 milliseconds of every second, @code{time}
-returns a value that is one less than the @code{tv_sec} part of the return
-value of @code{gettimeofday} or @code{timespec_get}.
+glibc 2.31 or newer on Linux, native Windows.
+Namely, in the first 1 to 2.5 milliseconds of every second (or, on Windows,
+in the first 5 milliseconds of every second), @code{time} returns a value
+that is one less than the @code{tv_sec} part of the return value of
+@code{gettimeofday} or @code{timespec_get}.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 0dbb6011ed51243bfd849f15030362141efd6d93..504ec77f8824850c70dcffacc8706c71199f555c 100644 (file)
@@ -1,4 +1,4 @@
-# time.m4 serial 1
+# time.m4 serial 2
 dnl Copyright (C) 2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,9 +12,11 @@ AC_DEFUN([gl_FUNC_TIME],
   dnl glibc has the bug https://sourceware.org/bugzilla/show_bug.cgi?id=30200 .
   AC_CACHE_CHECK([whether time() works],
     [gl_cv_func_time_works],
-    [dnl Guess that it works except on glibc >= 2.31 with Linux.
-     dnl And binaries produced on glibc < 2.31 need to run fine on newer
-     dnl glibc versions as well; therefore ignore __GLIBC_MINOR__.
+    [dnl Guess that it works except on
+     dnl   - glibc >= 2.31 with Linux. And binaries produced on glibc < 2.31
+     dnl     need to run fine on newer glibc versions as well; therefore ignore
+     dnl     __GLIBC_MINOR__.
+     dnl   - native Windows.
      case "$host_os" in
        linux*-gnu*)
          AC_EGREP_CPP([Unlucky], [
@@ -28,6 +30,7 @@ AC_DEFUN([gl_FUNC_TIME],
            [gl_cv_func_time_works="guessing no"],
            [gl_cv_func_time_works="guessing yes"])
          ;;
+       mingw*) gl_cv_func_time_works="guessing no";;
        *) gl_cv_func_time_works="guessing yes";;
      esac
     ])
index 45f5ffd35fbc860ce38f92c2f1a2b180861930f8..2729ad06eabe7c0a7968528559791a6365b86076 100644 (file)
@@ -7,6 +7,7 @@ m4/time.m4
 
 Depends-on:
 time-h
+gettimeofday    [test $REPLACE_TIME = 1]
 
 configure.ac:
 gl_FUNC_TIME