mirror of
https://github.com/transmission/transmission
synced 2025-02-13 18:04:43 +00:00
Don't explicitly protect against non-monotonic gettimeofday.
Since we're now protecting against non-monotonic time unconditionally, there's no need for additional protection in the gettimeofday case.
This commit is contained in:
parent
c0ef0f50ad
commit
7b06392812
1 changed files with 0 additions and 7 deletions
7
third-party/libutp/utp_utils.cpp
vendored
7
third-party/libutp/utp_utils.cpp
vendored
|
@ -141,15 +141,8 @@ static uint64_t GetMicroseconds()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
static time_t offset = 0, previous = 0;
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
rc = gettimeofday(&tv, NULL);
|
rc = gettimeofday(&tv, NULL);
|
||||||
tv.tv_sec += offset;
|
|
||||||
if (previous > tv.tv_sec) {
|
|
||||||
offset += previous - tv.tv_sec;
|
|
||||||
tv.tv_sec = previous;
|
|
||||||
}
|
|
||||||
previous = tv.tv_sec;
|
|
||||||
return uint64(tv.tv_sec) * 1000000 + tv.tv_usec;
|
return uint64(tv.tv_sec) * 1000000 + tv.tv_usec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue