Skip to content

Commit

Permalink
Fix for sudden stop sending data on macOS/iOS (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummilion authored and rndi committed Mar 15, 2018
1 parent 84d5e5e commit dade14d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions srtcore/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,17 @@ uint64_t CTimer::getTime()
// XXX Do further study on that. Currently Cygwin is also using gettimeofday,
// however Cygwin platform is supported only for testing purposes.

//For Cygwin and other systems without microsecond level resolution, uncomment the following three lines
//uint64_t x;
//rdtsc(x);
//return x / s_ullCPUFrequency;
//For other systems without microsecond level resolution, add to this conditional compile
#if defined(OSX) || defined(TARGET_OS_IOS) || defined(TARGET_OS_TV)
uint64_t x;
rdtsc(x);
return x / s_ullCPUFrequency;
//Specific fix may be necessary if rdtsc is not available either.

#else
timeval t;
gettimeofday(&t, 0);
return t.tv_sec * 1000000ULL + t.tv_usec;
#endif
}

void CTimer::triggerEvent()
Expand Down

0 comments on commit dade14d

Please sign in to comment.