| 635 | } |
| 636 | |
| 637 | bool 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 | |
| 660 | bool AmsDataStorage::isMonthHappy(time_t now) { |
| 661 | if(tz == NULL) { |
nothing calls this directly
no outgoing calls
no test coverage detected