在 2026-10-8 19:02, Kirill Makurin 写道:
Hello,This is new version of changes with fixes for issues discovered with help of DeepSeek.
Is there a reason why `_POSIX_TIMERS` is no longer defined? In GCC source code there's a check for it: https://github.com/gnutools/gcc/blob/9c3dc461749a1257b9939625ef59b2b056035311/gcc/timevar.cc#L162, and also the comment about `_POSIX_CLOCK_SELECTION` says it 'implies the _POSIX_TIMERS option' so `_POSIX_TIMERS` should be defined.
`GetSystemTimeAdjustmentPrecise()` is not exported from kernel32.dll; it's only exported from kernelbase.dll. `clock_nanosleep()` should return the error number directly; unlike `nanosleep()` it does not set `errno`. Also some more suggestions:diff --git a/mingw-w64-libraries/winpthreads/include/pthread_time.h b/mingw-w64-libraries/winpthreads/include/pthread_time.h
index ca3b2fef3..ffa55e01b 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread_time.h +++ b/mingw-w64-libraries/winpthreads/include/pthread_time.h @@ -114,8 +114,8 @@ WINPTHREAD_TIME_DECL int __cdecl clock_settime(clockid_t _C, const struct timesp #endif }-WINPTHREAD_API int __cdecl clock_nanosleep32(clockid_t, int , const struct _timespec32 *, struct _timespec32 *); -WINPTHREAD_API int __cdecl clock_nanosleep64(clockid_t, int , const struct _timespec64 *, struct _timespec64 *); +WINPTHREAD_API int __cdecl clock_nanosleep32(clockid_t, int, const struct _timespec32 *, struct _timespec32 *); +WINPTHREAD_API int __cdecl clock_nanosleep64(clockid_t, int, const struct _timespec64 *, struct _timespec64 *); WINPTHREAD_TIME_DECL int __cdecl clock_nanosleep(clockid_t _C, int _F, const struct timespec *_T1, struct timespec *_T2)
{
#if WINPTHREADS_TIME_BITS == 32
diff --git a/mingw-w64-libraries/winpthreads/src/time.c
b/mingw-w64-libraries/winpthreads/src/time.c
index e64973675..707fe6b71 100644
--- a/mingw-w64-libraries/winpthreads/src/time.c
+++ b/mingw-w64-libraries/winpthreads/src/time.c
@@ -434,7 +434,7 @@ int nanosleep64 (const struct _timespec64 *request, struct
_timespec64 *remain)
* It is possible that system time has been changed while we were sleeping,
* so we have to check for possible underflow.
*/
- if (likely (start.QuadPart < end.QuadPart)) {
+ if (likely (start.QuadPart <= end.QuadPart)) {
unsigned __int64 elapsedSleepTime = (end.QuadPart - start.QuadPart) /
POW10_4;
if (likely (elapsedSleepTime < totalSleepTime)) {
@@ -851,7 +851,7 @@ int clock_nanosleep32 (clockid_t clock_id, int flags, const
struct _timespec32 *
.tv_sec = request->tv_sec,
.tv_nsec = request->tv_nsec
};
- struct _timespec64 remain64;
+ struct _timespec64 remain64 = {0};
int error_code = clock_nanosleep64 (clock_id, flags, &request64, &remain64);
--
Best regards,
LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
