Lines Matching refs:base
186 adjust_monotonic_time(struct evutil_monotonic_timer *base, in adjust_monotonic_time() argument
189 evutil_timeradd(tv, &base->adjust_monotonic_clock, tv); in adjust_monotonic_time()
191 if (evutil_timercmp(tv, &base->last_time, <)) { in adjust_monotonic_time()
194 evutil_timersub(&base->last_time, tv, &adjust); in adjust_monotonic_time()
195 evutil_timeradd(&adjust, &base->adjust_monotonic_clock, in adjust_monotonic_time()
196 &base->adjust_monotonic_clock); in adjust_monotonic_time()
197 *tv = base->last_time; in adjust_monotonic_time()
199 base->last_time = *tv; in adjust_monotonic_time()
262 evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base, in evutil_configure_monotonic_time_() argument
284 base->monotonic_clock = CLOCK_MONOTONIC_COARSE; in evutil_configure_monotonic_time_()
290 base->monotonic_clock = CLOCK_MONOTONIC; in evutil_configure_monotonic_time_()
298 base->monotonic_clock = -1; in evutil_configure_monotonic_time_()
303 evutil_gettime_monotonic_(struct evutil_monotonic_timer *base, in evutil_gettime_monotonic_() argument
308 if (base->monotonic_clock < 0) { in evutil_gettime_monotonic_()
311 adjust_monotonic_time(base, tp); in evutil_gettime_monotonic_()
315 if (clock_gettime(base->monotonic_clock, &ts) == -1) in evutil_gettime_monotonic_()
337 evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base, in evutil_configure_monotonic_time_() argument
342 memset(base, 0, sizeof(*base)); in evutil_configure_monotonic_time_()
351 memcpy(&base->mach_timebase_units, &mi, sizeof(mi)); in evutil_configure_monotonic_time_()
353 base->mach_timebase_units.numer = 0; in evutil_configure_monotonic_time_()
359 evutil_gettime_monotonic_(struct evutil_monotonic_timer *base, in evutil_gettime_monotonic_() argument
363 if (base->mach_timebase_units.numer == 0) { in evutil_gettime_monotonic_()
366 adjust_monotonic_time(base, tp); in evutil_gettime_monotonic_()
371 usec = (abstime * base->mach_timebase_units.numer) in evutil_gettime_monotonic_()
372 / (base->mach_timebase_units.denom); in evutil_gettime_monotonic_()
442 evutil_GetTickCount_(struct evutil_monotonic_timer *base) in evutil_GetTickCount_() argument
444 if (base->GetTickCount64_fn) { in evutil_GetTickCount_()
446 return base->GetTickCount64_fn(); in evutil_GetTickCount_()
447 } else if (base->GetTickCount_fn) { in evutil_GetTickCount_()
453 ev_uint64_t v = base->GetTickCount_fn(); in evutil_GetTickCount_()
461 if (ticks < base->last_tick_count) { in evutil_GetTickCount_()
462 base->adjust_tick_count += ((ev_uint64_t)1) << 32; in evutil_GetTickCount_()
464 base->last_tick_count = ticks; in evutil_GetTickCount_()
465 return ticks + base->adjust_tick_count; in evutil_GetTickCount_()
470 evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base, in evutil_configure_monotonic_time_() argument
476 memset(base, 0, sizeof(*base)); in evutil_configure_monotonic_time_()
480 base->GetTickCount64_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount64"); in evutil_configure_monotonic_time_()
481 base->GetTickCount_fn = (ev_GetTickCount_func)GetProcAddress(h, "GetTickCount"); in evutil_configure_monotonic_time_()
484 base->first_tick = base->last_tick_count = evutil_GetTickCount_(base); in evutil_configure_monotonic_time_()
490 base->first_counter = counter.QuadPart; in evutil_configure_monotonic_time_()
491 base->usec_per_count = 1.0e6 / freq.QuadPart; in evutil_configure_monotonic_time_()
492 base->use_performance_counter = 1; in evutil_configure_monotonic_time_()
507 evutil_gettime_monotonic_(struct evutil_monotonic_timer *base, in evutil_gettime_monotonic_() argument
510 ev_uint64_t ticks = evutil_GetTickCount_(base); in evutil_gettime_monotonic_()
511 if (base->use_performance_counter) { in evutil_gettime_monotonic_()
521 (counter.QuadPart - base->first_counter); in evutil_gettime_monotonic_()
522 ticks_elapsed = ticks - base->first_tick; in evutil_gettime_monotonic_()
526 (counter_elapsed * base->usec_per_count); in evutil_gettime_monotonic_()
535 …base->first_counter = (ev_uint64_t) (counter.QuadPart - counter_usec_elapsed / base->usec_per_coun… in evutil_gettime_monotonic_()
545 adjust_monotonic_time(base, tp); in evutil_gettime_monotonic_()
559 evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base, in evutil_configure_monotonic_time_() argument
562 memset(base, 0, sizeof(*base)); in evutil_configure_monotonic_time_()
567 evutil_gettime_monotonic_(struct evutil_monotonic_timer *base, in evutil_gettime_monotonic_() argument
572 adjust_monotonic_time(base, tp); in evutil_gettime_monotonic_()