+#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+ timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
+ timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
+ mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
+ thread_basic_info_data_t thi_data;
+ thread_basic_info_t thi = &thi_data;
+ thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
+ timer->start.tv_usec = thi->system_time.microseconds + thi->user_time.microseconds;
+ timer->start.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
+#elif defined(HAVE_GETTIMEOFDAY)
+ timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
+ timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
+ gettimeofday(&(timer->start), NULL);