Skip to content

Commit

Permalink
fix timerprovider arm32 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Oct 11, 2023
1 parent ad4850a commit 8026c47
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions util/src/tc_timeprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,22 @@ uint64_t TC_TimeProvider::GetCycleCount()
void TC_TimeProvider::getNow(timeval *tv)
{
#if TARGET_PLATFORM_IOS || TARGET_PLATFORM_LINUX

int idx = _buf_idx;
*tv = _t[idx];
if(fabs(_cpu_cycle - 0) < 0.0001 && _use_tsc)
if(GetCycleCount() != 0)
{
addTimeOffset(*tv, idx);
int idx = _buf_idx;
*tv = _t[idx];
if (fabs(_cpu_cycle - 0) < 0.0001 && _use_tsc)
{
addTimeOffset(*tv, idx);
}
else
{
TC_Common::gettimeofday(*tv);
}
}
else
{
TC_Common::gettimeofday(*tv);
TC_Common::gettimeofday(*tv);
}
#else
TC_Common::gettimeofday(*tv);
Expand Down

0 comments on commit 8026c47

Please sign in to comment.