Haven’t changed my time management class yet it just stopped working. Below is the code used to set flags so that when reached later it will do something. Im sure what ever I did in some other file some how affected this but I have no idea how that would be, it complies and runs perfeclty fine. However when I put log statements in these ifs the only ones that run are the ones using Millis, none of the ones using the localtimeconvert ever trigger.
void TimingScheduler::updateTime()
{
time_t now = Time.now();
unsigned long nowMillis = millis(); // for half second intervals
if (nowMillis - nextQuaterSecond >= 250)
{
nextQuaterSecond = nowMillis;
markTimeFlagsOnTrackers(TimingInterval::QuaterSecond);
}
if (nowMillis - nextHalfSecond >= 500)
{
nextHalfSecond = nowMillis;
markTimeFlagsOnTrackers(TimingInterval::HalfSecond);
}
if (!nextSecond || nextSecond <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.addSeconds(1);
nextSecond = conv.time;
markTimeFlagsOnTrackers(TimingInterval::Second);
}
if (!nextHalfMinute || nextHalfMinute <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.addSeconds(30);
nextHalfMinute = conv.time;
markTimeFlagsOnTrackers(TimingInterval::HalfMinute);
}
if (!nextMinutely || nextMinutely <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextMinute();
nextMinutely = conv.time;
markTimeFlagsOnTrackers(TimingInterval::Minute);
}
if (!nextTenMinute || nextTenMinute <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextMinuteMultiple(10);
nextTenMinute = conv.time;
markTimeFlagsOnTrackers(TimingInterval::TenMinute);
}
if (!nextHalfHour || nextHalfHour <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextMinuteMultiple(30);
nextHalfHour = conv.time;
markTimeFlagsOnTrackers(TimingInterval::HalfHour);
}
if (!nextHourly || nextHourly <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextHour();
nextHourly = conv.time;
markTimeFlagsOnTrackers(TimingInterval::Hour);
}
if (!nextDaily || nextDaily <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextDayMidnight();
nextDaily = conv.time;
markTimeFlagsOnTrackers(TimingInterval::Daily);
}
if (!nextMonth || nextMonth <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextDayOfNextMonth(1);
nextMonth = conv.time;
markTimeFlagsOnTrackers(TimingInterval::Monthly);
}
if (!timeSyncOClock || timeSyncOClock <= now)
{
LocalTimeConvert conv;
conv.withCurrentTime().convert();
conv.nextDay(LocalTimeHMS("03:30:30")); // dont run anything super importnat around 3:30:30
// as the particle time sync will mess with time related things for a short period
timeSyncOClock = conv.time;
Particle.syncTime();
}
}