swimtracker-firmware/firmware/lib/basic/TimeAbstraction.h

16 lines
375 B
C++

#pragma once
#ifdef PLATFORM_ESP32
#include <Arduino.h>
#endif
#ifdef PLATFORM_NATIVE
#include <chrono>
inline unsigned long millis() {
static auto timeOfFirstCall = std::chrono::steady_clock::now();
const auto timePoint = std::chrono::steady_clock::now();
return std::chrono::duration_cast<std::chrono::milliseconds>(timePoint - timeOfFirstCall).count();
}
#endif