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

Method isMonthHappy

lib/AmsDataStorage/src/AmsDataStorage.cpp:660–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660bool AmsDataStorage::isMonthHappy(time_t now) {
661 if(tz == NULL) {
662 return false;
663 }
664
665 if(now < FirmwareVersion::BuildEpoch) return false;
666
667 if(now < month.lastMeterReadTime) {
668 return false;
669 }
670
671 // 25 hours, because of DST
672 if(now-month.lastMeterReadTime > 90000) {
673 return false;
674 }
675
676 tmElements_t tm, last;
677 breakTime(tz->toLocal(now), tm);
678 breakTime(tz->toLocal(month.lastMeterReadTime), last);
679 if(tm.Day != last.Day) {
680 return false;
681 }
682
683 return true;
684}
685
686double AmsDataStorage::getEstimatedImportCounter() {
687 if(day.lastMeterReadTime == 0) return 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected