mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
src/Mayaqua/Unix: remove unused code, improve readability of "ifdef"
refactoring was discussed in PR#672
This commit is contained in:
parent
3f394d23c1
commit
a55a3b50e8
@ -2060,12 +2060,6 @@ UINT64 UnixGetTick64()
|
|||||||
|
|
||||||
struct timespec t;
|
struct timespec t;
|
||||||
UINT64 ret;
|
UINT64 ret;
|
||||||
static bool akirame = false;
|
|
||||||
|
|
||||||
if (akirame)
|
|
||||||
{
|
|
||||||
return TickRealtimeManual();
|
|
||||||
}
|
|
||||||
|
|
||||||
Zero(&t, sizeof(t));
|
Zero(&t, sizeof(t));
|
||||||
|
|
||||||
@ -2073,20 +2067,17 @@ UINT64 UnixGetTick64()
|
|||||||
// Be careful. The Implementation is depend on the system.
|
// Be careful. The Implementation is depend on the system.
|
||||||
#ifdef CLOCK_HIGHRES
|
#ifdef CLOCK_HIGHRES
|
||||||
clock_gettime(CLOCK_HIGHRES, &t);
|
clock_gettime(CLOCK_HIGHRES, &t);
|
||||||
#else // CLOCK_HIGHRES
|
#elif CLOCK_MONOTONIC
|
||||||
#ifdef CLOCK_MONOTONIC
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||||
#else // CLOCK_MONOTONIC
|
#else
|
||||||
clock_gettime(CLOCK_REALTIME, &t);
|
clock_gettime(CLOCK_REALTIME, &t);
|
||||||
#endif // CLOCK_MONOTONIC
|
#endif
|
||||||
#endif // CLOCK_HIGHRES
|
|
||||||
|
|
||||||
ret = ((UINT64)((UINT32)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL;
|
ret = ((UINT64)((UINT32)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL;
|
||||||
|
|
||||||
if (akirame == false && ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
ret = TickRealtimeManual();
|
ret = TickRealtimeManual();
|
||||||
akirame = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user