Commit 12bed9ff authored by unknown's avatar unknown

Fix up definition of new set_timespec_nsec() macro. (Related to bug #12582)


include/my_global.h:
  Add distinct set_timespec_nsec() macro for when HAVE_TIMESPEC_TS_SEC
  is defined.
parent cbdd54e4
...@@ -927,7 +927,17 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ...@@ -927,7 +927,17 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#ifndef set_timespec #ifndef set_timespec
#ifdef HAVE_TIMESPEC_TS_SEC #ifdef HAVE_TIMESPEC_TS_SEC
#define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; } #define set_timespec(ABSTIME,SEC) \
{ \
(ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
(ABSTIME).ts_nsec=0; \
}
#define set_timespec_nsec(ABSTIME,NSEC) \
{\
ulonglong now= my_getsystime(); \
(ABSTIME).ts_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \
(ABSTIME).ts_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \
}
#else #else
#define set_timespec(ABSTIME,SEC) \ #define set_timespec(ABSTIME,SEC) \
{\ {\
...@@ -936,15 +946,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ...@@ -936,15 +946,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
(ABSTIME).tv_nsec=tv.tv_usec*1000;\ (ABSTIME).tv_nsec=tv.tv_usec*1000;\
} }
#endif /* HAVE_TIMESPEC_TS_SEC */
#endif /* set_timespec */
#define set_timespec_nsec(ABSTIME,NSEC) \ #define set_timespec_nsec(ABSTIME,NSEC) \
{\ {\
ulonglong now= my_getsystime(); \ ulonglong now= my_getsystime(); \
(ABSTIME).tv_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \ (ABSTIME).tv_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \
(ABSTIME).tv_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \ (ABSTIME).tv_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \
} }
#endif /* HAVE_TIMESPEC_TS_SEC */
#endif /* set_timespec */
/* /*
Define-funktions for reading and storing in machine independent format Define-funktions for reading and storing in machine independent format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment