MCPcopy Create free account
hub / github.com/UtilitechAS/amsreader-firmware / isDayHappy

Method isDayHappy

lib/AmsDataStorage/src/AmsDataStorage.cpp:637–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635}
636
637bool AmsDataStorage::isDayHappy(time_t now) {
638 if(tz == NULL) {
639 return false;
640 }
641
642 // If the timestamp is before the firware was built, there is something seriously wrong..
643 if(now < FirmwareVersion::BuildEpoch) {
644 return false;
645 }
646
647 // If the timestamp is before the last time we updated, there is also something wrong..
648 if(now < day.lastMeterReadTime) {
649 return false;
650 }
651
652 tmElements_t tm, last;
653 breakTime(tz->toLocal(now), tm);
654 breakTime(tz->toLocal(day.lastMeterReadTime), last);
655
656 // If the timestamp is at the same day and hour as last update, we are happy
657 return tm.Day == last.Day && tm.Hour == last.Hour;
658}
659
660bool AmsDataStorage::isMonthHappy(time_t now) {
661 if(tz == NULL) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected