mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
BUG#24687 func_misc test fails on win64
- Use same precision (milliseconds) for all time functions used when calculating time for pthread_cond_timedwait - Use 'GetSystemTimeAsFileTime' for both start and curr time include/config-win.h: Move all defines for 'pthread_cond_timedwait' to my_pthread.h include/my_global.h: Move all defines for 'pthread_cond_timedwait' to my_pthread.h include/my_pthread.h: Redefine "struct timespec" to better suite the needs of 'pthread_cond_timedwait' for windows implementation Add windows specific define for set_timespec_nsec Move all defines related to pthread_cond_timed wait to same file Declare union for reading FILETIME as __int64 with correct alignment mysys/my_wincond.c: Use 'GetSystemTimeAsFileTime()' both for getting start and current time Use new members of "struct timespec" Make sure the calculated timeout value never exceeds the value passed to set_timespec/set_timespec_nsec server-tools/instance-manager/guardian.cc: Use set_timespec macro server-tools/instance-manager/instance.cc: Use set_timespec macro
This commit is contained in:
@@ -1010,41 +1010,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
|
||||
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
|
||||
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
|
||||
|
||||
#ifdef HAVE_TIMESPEC_TS_SEC
|
||||
#ifndef set_timespec
|
||||
#define set_timespec(ABSTIME,SEC) \
|
||||
{ \
|
||||
(ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
|
||||
(ABSTIME).ts_nsec=0; \
|
||||
}
|
||||
#endif /* !set_timespec */
|
||||
#ifndef set_timespec_nsec
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) \
|
||||
{ \
|
||||
ulonglong now= my_getsystime() + (NSEC/100); \
|
||||
(ABSTIME).ts_sec= (now / ULL(10000000)); \
|
||||
(ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
|
||||
}
|
||||
#endif /* !set_timespec_nsec */
|
||||
#else
|
||||
#ifndef set_timespec
|
||||
#define set_timespec(ABSTIME,SEC) \
|
||||
{\
|
||||
struct timeval tv;\
|
||||
gettimeofday(&tv,0);\
|
||||
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
|
||||
(ABSTIME).tv_nsec=tv.tv_usec*1000;\
|
||||
}
|
||||
#endif /* !set_timespec */
|
||||
#ifndef set_timespec_nsec
|
||||
#define set_timespec_nsec(ABSTIME,NSEC) \
|
||||
{\
|
||||
ulonglong now= my_getsystime() + (NSEC/100); \
|
||||
(ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
|
||||
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
|
||||
}
|
||||
#endif /* !set_timespec_nsec */
|
||||
#endif /* HAVE_TIMESPEC_TS_SEC */
|
||||
|
||||
|
||||
/*
|
||||
Define-funktions for reading and storing in machine independent format
|
||||
|
||||
Reference in New Issue
Block a user