1
This commit is contained in:
parent
70de530831
commit
34ef4b27ee
@ -9,9 +9,18 @@ namespace a8
|
||||
{
|
||||
a8::tick_t XGetTickCount()
|
||||
{
|
||||
#if 1
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long time = tv.tv_usec;
|
||||
time /= 1000;
|
||||
time += (tv.tv_sec * 1000);
|
||||
return time;
|
||||
#else
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (ts.tv_sec*1000 + ts.tv_nsec/(1000*1000));
|
||||
#endif
|
||||
}
|
||||
|
||||
long long XGetNanoSeconds()
|
||||
|
@ -245,7 +245,7 @@ namespace a8
|
||||
int idle_time = 1;
|
||||
for (int lv1_idx = base_->timer_tick & TVR_MASK; lv1_idx < TVR_SIZE; ++lv1_idx) {
|
||||
if (!list_empty(base_->tv1.vec + lv1_idx)) {
|
||||
return idle_time;
|
||||
return idle_time <= 1 ? 1 : idle_time - 1;
|
||||
}
|
||||
++idle_time;
|
||||
}
|
||||
@ -257,7 +257,7 @@ namespace a8
|
||||
idle_time += TVR_SIZE;
|
||||
}
|
||||
#endif
|
||||
return idle_time;
|
||||
return idle_time <= 1 ? 1 : idle_time - 1;
|
||||
}
|
||||
|
||||
void Timer::UpdateTimer()
|
||||
|
Loading…
x
Reference in New Issue
Block a user