Bug #12100 gettimeofday() not available on windows
Submitted: 22 Jul 2005 1:11 Modified: 22 Jul 2005 19:03
Reporter: Jim Winstead Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.1.11-bk OS:
Assigned to: Jim Winstead CPU Architecture:Any

[22 Jul 2005 1:11] Jim Winstead
Description:
A call to gettimeofday() was added to thr_lock.c, but this function is not available on Windows.

How to repeat:
Try to compile 5.1.11 (from BK) on Windows.

Suggested fix:
--- mysql-5.0-before/mysys/thr_lock.c 2005-07-20 14:51:49.000000000 -0700
+++ mysql-5.0-after/mysys/thr_lock.c  2005-07-21 19:48:48.000000000 -0700
@@ -388,7 +388,6 @@
 {
   struct st_my_thread_var *thread_var= my_thread_var;
   pthread_cond_t *cond= &thread_var->suspend;
-  struct timeval now;
   struct timespec wait_timeout;
   enum enum_thr_lock_result result= THR_LOCK_ABORTED;
   my_bool can_deadlock= test(data->owner->info->n_cursors);
@@ -406,11 +405,7 @@
   data->cond= cond;

   if (can_deadlock)
-  {
-    gettimeofday(&now, 0);
-    wait_timeout.tv_sec= now.tv_sec + table_lock_wait_timeout;
-    wait_timeout.tv_nsec= now.tv_usec * 1000;
-  }
+       set_timespec(wait_timeout, table_lock_wait_timeout);^M
[22 Jul 2005 1:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27453
[22 Jul 2005 19:03] Jim Winstead
Fixed in 5.1.10. No need to document.