summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/network/torrent/connectionmanager.cpp2
-rw-r--r--examples/network/torrent/metainfo.cpp2
-rw-r--r--examples/network/torrent/torrentclient.cpp4
-rw-r--r--examples/widgets/animation/stickman/lifecycle.cpp2
-rw-r--r--examples/widgets/painting/composition/composition.cpp2
-rw-r--r--src/corelib/io/qsettings_mac.cpp4
-rw-r--r--src/corelib/plugin/quuid.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp2
-rw-r--r--src/network/access/qnetworkcookie.cpp2
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp30
-rw-r--r--src/network/kernel/qauthenticator.cpp8
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp2
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp2
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp4
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp2
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp2
17 files changed, 36 insertions, 40 deletions
diff --git a/examples/network/torrent/connectionmanager.cpp b/examples/network/torrent/connectionmanager.cpp
index 99462fb489..acab59b0e3 100644
--- a/examples/network/torrent/connectionmanager.cpp
+++ b/examples/network/torrent/connectionmanager.cpp
@@ -86,7 +86,7 @@ QByteArray ConnectionManager::clientId() const
{
if (id.isEmpty()) {
// Generate peer id
- int startupTime = int(QDateTime::currentDateTime().toTime_t());
+ qint64 startupTime = QDateTime::currentSecsSinceEpoch();
id += QString::asprintf("-QT%04x-", (QT_VERSION % 0xffff00) >> 8).toLatin1();
id += QByteArray::number(startupTime, 10);
diff --git a/examples/network/torrent/metainfo.cpp b/examples/network/torrent/metainfo.cpp
index e3718999b8..565533e2f9 100644
--- a/examples/network/torrent/metainfo.cpp
+++ b/examples/network/torrent/metainfo.cpp
@@ -141,7 +141,7 @@ bool MetaInfo::parse(const QByteArray &data)
}
if (dict.contains("creation date"))
- metaInfoCreationDate.setTime_t(dict.value("creation date").toInt());
+ metaInfoCreationDate.setSecsSinceEpoch(dict.value("creation date").toInt());
if (dict.contains("comment"))
metaInfoComment = QString::fromUtf8(dict.value("comment").toByteArray());
if (dict.contains("created by"))
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index 6b184be39c..ba87924ff9 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -703,7 +703,7 @@ void TorrentClient::connectToPeers()
// Pick a random peer from the list of weighed peers.
TorrentPeer *peer = weighedPeers.takeAt(qrand() % weighedPeers.size());
weighedPeers.removeAll(peer);
- peer->connectStart = QDateTime::currentDateTime().toTime_t();
+ peer->connectStart = QDateTime::currentSecsSinceEpoch();
peer->lastVisited = peer->connectStart;
// Connect to the peer.
@@ -717,7 +717,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
QList<TorrentPeer *> weighedPeers;
// Generate a list of peers that we want to connect to.
- uint now = QDateTime::currentDateTime().toTime_t();
+ qint64 now = QDateTime::currentSecsSinceEpoch();
QList<TorrentPeer *> freePeers;
QMap<QString, int> connectionsPerPeer;
foreach (TorrentPeer *peer, d->peers) {
diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp
index fcb351cf36..0ece4f3932 100644
--- a/examples/widgets/animation/stickman/lifecycle.cpp
+++ b/examples/widgets/animation/stickman/lifecycle.cpp
@@ -91,7 +91,7 @@ public:
: QEventTransition(this, QEvent::Timer)
{
setTargetState(target);
- qsrand((uint)QDateTime::currentDateTime().toTime_t());
+ qsrand((uint)QDateTime::currentSecsSinceEpoch());
startTimer(1000);
}
diff --git a/examples/widgets/painting/composition/composition.cpp b/examples/widgets/painting/composition/composition.cpp
index 1c2802f860..d5d674fd83 100644
--- a/examples/widgets/painting/composition/composition.cpp
+++ b/examples/widgets/painting/composition/composition.cpp
@@ -290,7 +290,7 @@ void CompositionRenderer::updateCirclePos()
if (m_current_object != NoObject)
return;
QDateTime dt = QDateTime::currentDateTime();
- qreal t = (dt.toTime_t() * 1000 + dt.time().msec()) / 1000.0;
+ qreal t = dt.toMSecsSinceEpoch() / 1000.0;
qreal x = width() / qreal(2) + (qCos(t*8/11) + qSin(-t)) * width() / qreal(4);
qreal y = height() / qreal(2) + (qSin(t*6/7) + qCos(t * qreal(1.5))) * height() / qreal(4);
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<CFPropertyListRef> 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<CFDateRef>(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
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 18df8c35a6..4ab8160f21 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -770,7 +770,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
QFileInfo info(fileName);
QString key = QLatin1String("qt_pixmap")
% info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toTime_t())
+ % HexString<uint>(info.lastModified().toSecsSinceEpoch())
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 21dc12829a..7a538cbf08 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -970,7 +970,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
if (ok) {
if (secs <= 0) {
//earliest representable time (RFC6265 section 5.2.2)
- cookie.setExpirationDate(QDateTime::fromTime_t(0));
+ cookie.setExpirationDate(QDateTime::fromSecsSinceEpoch(0));
} else {
cookie.setExpirationDate(now.addSecs(secs));
}
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 30f4bb26ce..d98a1a1d62 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -522,36 +522,36 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
* now
* is the current (local) time
*/
- int age_value = 0;
+ qint64 age_value = 0;
it = cacheHeaders.findRawHeader("age");
if (it != cacheHeaders.rawHeaders.constEnd())
- age_value = it->second.toInt();
+ age_value = it->second.toLongLong();
QDateTime dateHeader;
- int date_value = 0;
+ qint64 date_value = 0;
it = cacheHeaders.findRawHeader("date");
if (it != cacheHeaders.rawHeaders.constEnd()) {
dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second);
- date_value = dateHeader.toTime_t();
+ date_value = dateHeader.toSecsSinceEpoch();
}
- int now = currentDateTime.toTime_t();
- int request_time = now;
- int response_time = now;
+ qint64 now = currentDateTime.toSecsSinceEpoch();
+ qint64 request_time = now;
+ qint64 response_time = now;
// Algorithm from RFC 2616 section 13.2.3
- int apparent_age = qMax(0, response_time - date_value);
- int corrected_received_age = qMax(apparent_age, age_value);
- int response_delay = response_time - request_time;
- int corrected_initial_age = corrected_received_age + response_delay;
- int resident_time = now - response_time;
- int current_age = corrected_initial_age + resident_time;
+ qint64 apparent_age = qMax<qint64>(0, response_time - date_value);
+ qint64 corrected_received_age = qMax(apparent_age, age_value);
+ qint64 response_delay = response_time - request_time;
+ qint64 corrected_initial_age = corrected_received_age + response_delay;
+ qint64 resident_time = now - response_time;
+ qint64 current_age = corrected_initial_age + resident_time;
- int freshness_lifetime = 0;
+ qint64 freshness_lifetime = 0;
// RFC 2616 13.2.4 Expiration Calculations
if (lastModified.isValid() && dateHeader.isValid()) {
- int diff = lastModified.secsTo(dateHeader);
+ qint64 diff = lastModified.secsTo(dateHeader);
freshness_lifetime = diff / 10;
if (httpRequest.headerField("Warning").isEmpty()) {
QDateTime dt = currentDateTime.addSecs(current_age);
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 959db6e9d9..469879c78b 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -1271,14 +1271,10 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx,
if(timeArray.size()) {
ds.writeRawData(timeArray.constData(), timeArray.size());
} else {
- QDateTime currentTime(QDate::currentDate(),
- QTime::currentTime(), Qt::UTC);
-
- // number of seconds between 1601 and epoc(1970)
+ // number of seconds between 1601 and the epoch (1970)
// 369 years, 89 leap years
// ((369 * 365) + 89) * 24 * 3600 = 11644473600
-
- time = Q_UINT64_C(currentTime.toTime_t() + 11644473600);
+ time = QDateTime::currentSecsSinceEpoch() + 11644473600;
// represented as 100 nano seconds
time = Q_UINT64_C(time * 10000000);
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index a692d3c63f..426cca139d 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -285,7 +285,7 @@ quint64 QNetworkSessionPrivateImpl::bytesReceived() const
quint64 QNetworkSessionPrivateImpl::activeTime() const
{
if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0))
- return QDateTime::currentDateTimeUtc().toTime_t() - startTime;
+ return QDateTime::currentSecsSinceEpoch() - startTime;
return Q_UINT64_C(0);
}
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index eea79406c3..b3527f5d27 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -141,7 +141,7 @@ inline bool qIsLikelyToBeNfs(int /* handle */)
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentDateTimeUtc().toTime_t());
+ qsrand(QDateTime::currentSecsSinceEpoch());
return QDir::tempPath() + "/tst_qfileinfo-XXXXXX";
}
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 593706ac0d..a7ab221dda 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -116,7 +116,7 @@ Q_CONSTRUCTOR_FUNCTION(initializeLang)
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentDateTimeUtc().toTime_t());
+ qsrand(QDateTime::currentSecsSinceEpoch());
return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX";
}
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 8c9dc16ce7..8d9a789507 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -145,8 +145,8 @@ tst_QLocale::tst_QLocale()
qRegisterMetaType<QLocale::FormatType>("QLocale::FormatType");
// Test if in Central European Time zone
- uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
- uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
+ uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toSecsSinceEpoch();
+ uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toSecsSinceEpoch();
europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
}
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index 0def290eff..0edc5a92ea 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -1818,7 +1818,7 @@ void tst_QDBusAbstractAdaptor::typeMatching_data()
LLDateTimeMap lldtmap;
lldtmap[-1] = QDateTime();
QDateTime now = QDateTime::currentDateTime();
- lldtmap[now.toTime_t()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int
+ lldtmap[now.toSecsSinceEpoch()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int
QTest::newRow("lldtmap") << "LLDateTimeMap" << "a{x((iii)(iiii)i)}" << QVariant::fromValue(lldtmap);
MyStruct s;
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 0ce0e8d0f5..68473906b0 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -539,7 +539,7 @@ void tst_NetworkSelfTest::httpServer()
{
QByteArray uniqueExtension = QByteArray::number((qulonglong)this) +
QByteArray::number((qulonglong)qrand()) +
- QByteArray::number((qulonglong)QDateTime::currentDateTime().toTime_t());
+ QByteArray::number(QDateTime::currentSecsSinceEpoch());
netChat(80, QList<Chat>()
// HTTP/0.9 chat: