From 9e49778380c056b1ce7f30dbd774c545bff030c5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jun 2016 14:27:48 -0700 Subject: Fix/adapt the uses of {to,set,from}Time_t in the qtbase source code Move those to the equivalent {to,set,from}SecsSinceEpoch(), except for the cases that did QDateTime::currentDateTime{,Utc}().toTime_t. Those are best implemented with QDateTime::currentSecsSinceEpoch(). Change-Id: Ib57b52598e2f452985e9fffd145a366c92cfda20 Reviewed-by: Edward Welbourne --- src/corelib/io/qsettings_mac.cpp | 4 ++-- src/corelib/plugin/quuid.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index 72160a4769..7f857a77a4 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -181,7 +181,7 @@ static QCFType macValue(const QVariant &value) QDateTime dt = value.toDateTime(); if (dt.timeSpec() == Qt::LocalTime) { QDateTime reference; - reference.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970); + reference.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970)); result = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTime(reference.secsTo(dt))); } else { goto string_case; @@ -293,7 +293,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue) return map; } else if (typeId == CFDateGetTypeID()) { QDateTime dt; - dt.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970); + dt.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970)); return dt.addSecs((int)CFDateGetAbsoluteTime(static_cast(cfvalue))); } return QVariant(); diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 875e8b8368..f11ac6548b 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -969,7 +969,7 @@ QUuid QUuid::createUuid() { int *pseed = new int; static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - qsrand(*pseed = QDateTime::currentDateTimeUtc().toTime_t() + qsrand(*pseed = QDateTime::currentSecsSinceEpoch() + quintptr(&pseed) + serial.fetchAndAddRelaxed(1)); uuidseed.setLocalData(pseed); @@ -977,7 +977,7 @@ QUuid QUuid::createUuid() #else static bool seeded = false; if (!seeded) - qsrand(QDateTime::currentDateTimeUtc().toSecsSinceEpoch() + qsrand(QDateTime::currentSecsSinceEpoch() + quintptr(&seeded)); #endif -- cgit v1.2.3