Skip to content

Commit

Permalink
Merge pull request #10 from daschuer/1.12-shoutcast-fixes
Browse files Browse the repository at this point in the history
Fix Apple time base
  • Loading branch information
illuusio committed Oct 20, 2015
2 parents 8cc4bb3 + 70198c5 commit cef330c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/engine/sidechain/enginenetworkstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ qint64 EngineNetworkStream::getNetworkTimeUs() {
}
return now;
}
#elif defined(__APPLE__)
// clock_gettime is not implemented on OSX
// gettimeofday can go backward due to NTP adjusting
// this will work here, because we take the stream start time for reference
struct timeval mtv;
gettimeofday(&mtv, NULL);
return (qint64)(mtv.tv_sec) * 1000000 + mtv.tv_usec;
#else
// CLOCK_MONOTONIC is NTP adjusted
struct timespec ts;
Expand Down

0 comments on commit cef330c

Please sign in to comment.