diff options
Diffstat (limited to 'src/corelib/tools/qdatetime.cpp')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 49e7173de0..58755c94bb 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2339,7 +2339,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT // localtime_r() does not have this requirement, so make an explicit call. // The explicit call should also request the timezone info be re-parsed. qt_tzset(); -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) +#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // Use the reentrant version of localtime() where available // as is thread-safe and doesn't use a shared static data area tm *res = 0; @@ -2979,18 +2979,18 @@ inline QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime // DST transitions are disambiguated by hint. inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone &zone, DaylightStatus hint, - QDate *localDate, QTime *localTime) + QDate *zoneDate, QTime *zoneTime) { // Get the effective data from QTimeZone 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. - if (data.atMSecsSinceEpoch >= 0) { - msecsToTime(data.atMSecsSinceEpoch + (data.offsetFromUtc * 1000), localDate, localTime); - return data.atMSecsSinceEpoch; + if (data.atMSecsSinceEpoch < 0) { + msecsToTime(zoneMSecs, zoneDate, zoneTime); + return zoneMSecs - data.standardTimeOffset * 1000; } else { - msecsToTime(zoneMSecs, localDate, localTime); - return zoneMSecs - (data.standardTimeOffset * 1000); + msecsToTime(data.atMSecsSinceEpoch + data.offsetFromUtc * 1000, zoneDate, zoneTime); + return data.atMSecsSinceEpoch; } } #endif // timezone |