In a CI run of libunistring (on GitHub), I see a test failure: ../../tests/test-usleep.c:35: assertion 'start < time (NULL)' failed FAIL test-usleep.exe (exit status: 134)
This is the failing code: time_t start = time (NULL); ASSERT (usleep (1000000) == 0); ASSERT (start < time (NULL)); It means that either usleep() has slept for less than 1 second, or that time (NULL) returned the same value after 1 second or more had elapsed. Since we have no better way to measure time than time() and gettimeofday(), I'll blame usleep. 2024-06-07 Bruno Haible <br...@clisp.org> usleep: Document Cygwin bug. * doc/pastposix-functions/usleep.texi: Mention Cygwin 3.5.3 bug. diff --git a/doc/pastposix-functions/usleep.texi b/doc/pastposix-functions/usleep.texi index 5d26adbc0b..3de259c4cc 100644 --- a/doc/pastposix-functions/usleep.texi +++ b/doc/pastposix-functions/usleep.texi @@ -20,4 +20,7 @@ According to POSIX, the @code{usleep} function may interfere with the program's use of the @code{SIGALRM} signal. On Linux, it doesn't; on other platforms, it may. +@item +On some systems, @code{usleep} may sleep for less than the indicated duration: +Cygwin 3.5.3. @end itemize