QDateTime: fix some misnamed variables, s/local/zone/

When I wrote zoneMSecsToEpochMSecs I seem to have copied names from
localMSecsToEpochMSecs, that need a s/local/zone/ change to their
names to make sense in this context.  Flipped an if/else for clarity
in the process.

Change-Id: If2b288532b16d999f6ff0b9241e2dbcbc016b010
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2017-12-06 11:35:05 +01:00
parent 40a98ea750
commit e000c60ab3

View File

@ -2979,18 +2979,18 @@ inline QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime
// DST transitions are disambiguated by hint. // DST transitions are disambiguated by hint.
inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone &zone, inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone &zone,
DaylightStatus hint, DaylightStatus hint,
QDate *localDate, QTime *localTime) QDate *zoneDate, QTime *zoneTime)
{ {
// Get the effective data from QTimeZone // Get the effective data from QTimeZone
QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs, int(hint)); QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs, int(hint));
// Docs state any LocalTime before 1970-01-01 will *not* have any DST applied // Docs state any time before 1970-01-01 will *not* have any DST applied
// but all affected times afterwards will have DST applied. // but all affected times afterwards will have DST applied.
if (data.atMSecsSinceEpoch >= 0) { if (data.atMSecsSinceEpoch < 0) {
msecsToTime(data.atMSecsSinceEpoch + (data.offsetFromUtc * 1000), localDate, localTime); msecsToTime(zoneMSecs, zoneDate, zoneTime);
return data.atMSecsSinceEpoch; return zoneMSecs - data.standardTimeOffset * 1000;
} else { } else {
msecsToTime(zoneMSecs, localDate, localTime); msecsToTime(data.atMSecsSinceEpoch + data.offsetFromUtc * 1000, zoneDate, zoneTime);
return zoneMSecs - (data.standardTimeOffset * 1000); return data.atMSecsSinceEpoch;
} }
} }
#endif // timezone #endif // timezone