chore(simu): remove dependency to getopt() (#6474)

This commit is contained in:
Raphael Coeffic
2025-07-28 09:00:43 +10:00
committed by GitHub
parent 2a1538417b
commit 3285b8a6fd
7 changed files with 184 additions and 112 deletions
-27
View File
@@ -69,35 +69,8 @@ void lcdCopy(void * dest, void * src);
uint64_t simuTimerMicros(void)
{
#if SIMPGMSPC_USE_QT
static QElapsedTimer ticker;
if (!ticker.isValid())
ticker.start();
return ticker.nsecsElapsed() / 1000;
#elif defined(_MSC_VER)
static double freqScale = 0.0;
static LARGE_INTEGER firstTick;
LARGE_INTEGER newTick;
if (!freqScale) {
LARGE_INTEGER frequency;
// get ticks per second
QueryPerformanceFrequency(&frequency);
// 1us resolution
freqScale = 1e6 / frequency.QuadPart;
// init timer
QueryPerformanceCounter(&firstTick);
TRACE_SIMPGMSPACE("microsTimer() init: first tick = %llu @ %llu Hz", firstTick.QuadPart, frequency.QuadPart);
}
// read the timer
QueryPerformanceCounter(&newTick);
// compute the elapsed time
return (newTick.QuadPart - firstTick.QuadPart) * freqScale;
#else // GNUC
auto now = std::chrono::steady_clock::now();
return (uint64_t) std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count();
#endif
}
uint16_t getTmr16KHz()