Compare commits
4 Commits
remotes/or
...
2.4.0
Author | SHA1 | Date | |
---|---|---|---|
ae985d25ce
|
|||
6a215d4cf9
|
|||
a3f4a742ce
|
|||
e6d8c04076 |
@@ -65,13 +65,22 @@ struct ATBTariffCarryOver {
|
|||||||
int minutes = 0;
|
int minutes = 0;
|
||||||
QString end = m_range.m_end.toString(Qt::ISODate);
|
QString end = m_range.m_end.toString(Qt::ISODate);
|
||||||
if (end == "24:00:00") {
|
if (end == "24:00:00") {
|
||||||
QDateTime t = dt.addDays(1);
|
// note: this did not work
|
||||||
t.setTime(QTime(0,0,0));
|
// QDateTime t(dt.addDays(1));
|
||||||
minutes = dt.secsTo(t) / 60;
|
// 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 {
|
} else {
|
||||||
QDateTime t(dt);
|
QTime t(QTime::fromString(end, Qt::ISODate));
|
||||||
t.setTime(QTime::fromString(end, Qt::ISODate));
|
if (t.isValid() && dt.time().isValid()) {
|
||||||
minutes = dt.secsTo(t) / 60;
|
minutes = (t.hour() * 60 + t.minute()) - (dt.time().hour() * 60 + dt.time().minute());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minutes < 0 || minutes > m_range.m_duration) {
|
if (minutes < 0 || minutes > m_range.m_duration) {
|
||||||
|
@@ -396,14 +396,12 @@ int CALCULATE_LIBRARY_API get_zone_nr(int zone)
|
|||||||
if(zone > -1) return zone;
|
if(zone > -1) return zone;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFile zone("/etc/zone_nr");
|
QFile zone("/mnt/system_data/zone_nr");
|
||||||
if (zone.exists()) {
|
if (zone.exists()) {
|
||||||
QFileInfo finfo(zone);
|
QFileInfo finfo(zone);
|
||||||
if (finfo.size() <= 4) { // decimal 000\n
|
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
QTextStream in(&zone);
|
||||||
QTextStream in(&zone);
|
return in.readLine(100).toInt();
|
||||||
return in.readLine(100).toInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user