- fixed event queue for events >36min

This commit is contained in:
Martin Willi 2006-05-30 13:22:46 +00:00
parent 8403b34bd9
commit b93782903f
1 changed files with 17 additions and 30 deletions

View File

@ -85,7 +85,6 @@ static event_t *event_create(timeval_t time, job_t *job)
return this;
}
typedef struct private_event_queue_t private_event_queue_t;
/**
@ -118,16 +117,7 @@ struct private_event_queue_t {
};
/**
* Returns the difference of to timeval structs in microseconds
*
* @param end_time end time
* @param start_time start time
*
* @warning this function is also defined in the tester class
* In later improvements, this function can be added to a general
* class type!
*
* @return difference in microseconds (end time - start time)
* Returns the difference of to timeval structs in milliseconds
*/
static long time_difference(struct timeval *end_time, struct timeval *start_time)
{
@ -135,10 +125,9 @@ static long time_difference(struct timeval *end_time, struct timeval *start_time
seconds = (end_time->tv_sec - start_time->tv_sec);
microseconds = (end_time->tv_usec - start_time->tv_usec);
return ((seconds * 1000000) + microseconds);
return ((seconds * 1000) + microseconds/1000);
}
/**
* Implements event_queue_t.get_count
*/
@ -208,10 +197,8 @@ static job_t *get(private_event_queue_t *this)
next_event->destroy(next_event);
break;
}
}
pthread_cond_signal( &(this->condvar));
pthread_mutex_unlock(&(this->mutex));
return job;