From f1105393da1bb76aa2ba245d7bffd42f5f4e617e Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 18 Jul 2020 04:24:16 +0200 Subject: [PATCH] Replace QDateTime::toTime_t() with QDateTime::toSecsSinceEpoch() --- src/internet/localredirectserver.cpp | 2 +- src/scrobbler/listenbrainzscrobbler.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/internet/localredirectserver.cpp b/src/internet/localredirectserver.cpp index 1e4cf1df..767c56e8 100644 --- a/src/internet/localredirectserver.cpp +++ b/src/internet/localredirectserver.cpp @@ -145,7 +145,7 @@ bool LocalRedirectServer::GenerateCertificate() { gnutls_global_deinit(); return false; } - quint64 time = QDateTime::currentDateTime().toTime_t(); + quint64 time = QDateTime::currentDateTime().toSecsSinceEpoch(); gnutls_x509_crt_set_activation_time(crt, time); if (int result = gnutls_x509_crt_set_expiration_time(crt, time + 31536000L) != GNUTLS_E_SUCCESS) { error_ = QString("Failed to set the activation time of the certificate: %1").arg(gnutls_strerror(result)); diff --git a/src/scrobbler/listenbrainzscrobbler.cpp b/src/scrobbler/listenbrainzscrobbler.cpp index 94b76546..0b6be2a4 100644 --- a/src/scrobbler/listenbrainzscrobbler.cpp +++ b/src/scrobbler/listenbrainzscrobbler.cpp @@ -122,7 +122,7 @@ void ListenBrainzScrobbler::LoadSession() { s.endGroup(); if (!refresh_token_.isEmpty()) { - qint64 time = expires_in_ - (QDateTime::currentDateTime().toTime_t() - login_time_); + qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_); if (time < 6) time = 6; refresh_login_timer_.setInterval(time * kMsecPerSec); refresh_login_timer_.start(); @@ -318,7 +318,7 @@ void ListenBrainzScrobbler::AuthenticateReplyFinished(QNetworkReply *reply) { if (json_obj.contains("refresh_token")) { refresh_token_ = json_obj["refresh_token"].toString(); } - login_time_ = QDateTime::currentDateTime().toTime_t(); + login_time_ = QDateTime::currentDateTime().toSecsSinceEpoch(); QSettings s; s.beginGroup(kSettingsGroup); @@ -413,7 +413,7 @@ void ListenBrainzScrobbler::UpdateNowPlaying(const Song &song) { song_playing_ = song; scrobbled_ = false; - timestamp_ = QDateTime::currentDateTime().toTime_t(); + timestamp_ = QDateTime::currentDateTime().toSecsSinceEpoch(); if (!song.is_metadata_good() || !IsAuthenticated() || app_->scrobbler()->IsOffline()) return; @@ -629,7 +629,7 @@ void ListenBrainzScrobbler::Error(const QString &error, const QVariant &debug) { void ListenBrainzScrobbler::CheckScrobblePrevSong() { - quint64 duration = QDateTime::currentDateTime().toTime_t() - timestamp_; + quint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - timestamp_; if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.source() == Song::Source_Stream && duration > 30) { Song song(song_playing_);