Files
platformio_fensterpiepser_e…/src/Seconds.cpp
T

31 lines
480 B
C++
Raw Normal View History

/*
* Seconds.cpp
*
* Created on: 10.09.2020
* Author: flori
*/
#include "Seconds.h"
uint32_t Seconds::lastMillisShifted = 0;
uint32_t Seconds::seconds = 0;
uint32_t Seconds::secondsOverflow = 0;
boolean volatile Seconds::semaphore = false;
uint32_t Seconds::Get(void)
{
uint32_t secRet;
uint32_t secNow = millis() / 1000;
if (secNow < seconds)
{
secondsOverflow += seconds + 1;
}
seconds = secNow;
secRet = seconds + secondsOverflow;
return secRet;
}