Compare commits

..

4 Commits

2 changed files with 19 additions and 12 deletions

View File

@@ -65,13 +65,22 @@ struct ATBTariffCarryOver {
int minutes = 0;
QString end = m_range.m_end.toString(Qt::ISODate);
if (end == "24:00:00") {
QDateTime t = dt.addDays(1);
t.setTime(QTime(0,0,0));
minutes = dt.secsTo(t) / 60;
// note: this did not work
// QDateTime t(dt.addDays(1));
// t.setTime(QTime(0,0,0));
// dt: 2024-10-27T00:00:00 EEST, but t: 2024-10-28T00:00:00 EET (!)
// so the difference is 1500 instead of 1440
// reason: change from summer to winter time
// compute minutes directly
if (dt.time().isValid()) {
minutes = 1440 - (dt.time().hour() * 60 + dt.time().minute());
}
} else {
QDateTime t(dt);
t.setTime(QTime::fromString(end, Qt::ISODate));
minutes = dt.secsTo(t) / 60;
QTime t(QTime::fromString(end, Qt::ISODate));
if (t.isValid() && dt.time().isValid()) {
minutes = (t.hour() * 60 + t.minute()) - (dt.time().hour() * 60 + dt.time().minute());
}
}
if (minutes < 0 || minutes > m_range.m_duration) {

View File

@@ -396,14 +396,12 @@ int CALCULATE_LIBRARY_API get_zone_nr(int zone)
if(zone > -1) return zone;
else
{
QFile zone("/etc/zone_nr");
QFile zone("/mnt/system_data/zone_nr");
if (zone.exists()) {
QFileInfo finfo(zone);
if (finfo.size() <= 4) { // decimal 000\n
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&zone);
return in.readLine(100).toInt();
}
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&zone);
return in.readLine(100).toInt();
}
}
return -1;