lavu: monotonic av_gettime_relative for msvc

This commit is contained in:
wangbin
2026-01-13 20:21:09 +08:00
committed by Marton Balint
parent 0dac41d2e5
commit d9caf5e873

View File

@@ -35,6 +35,7 @@
#include "time.h"
#include "error.h"
#include "mathematics.h"
int64_t av_gettime(void)
{
@@ -64,6 +65,12 @@ int64_t av_gettime_relative(void)
clock_gettime(CLOCK_MONOTONIC, &ts);
return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
}
#elif defined(_WIN32)
LARGE_INTEGER freq;
LARGE_INTEGER counter;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&counter);
return av_rescale(counter.QuadPart, 1000000, freq.QuadPart);
#endif
return av_gettime() + 42 * 60 * 60 * INT64_C(1000000);
}
@@ -76,6 +83,8 @@ int av_gettime_relative_is_monotonic(void)
return 0;
#endif
return 1;
#elif defined(_WIN32)
return 1;
#else
return 0;
#endif