Replace QDateTime::toTime_t() with QDateTime::toSecsSinceEpoch()
This commit is contained in:
@@ -145,7 +145,7 @@ bool LocalRedirectServer::GenerateCertificate() {
|
|||||||
gnutls_global_deinit();
|
gnutls_global_deinit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
quint64 time = QDateTime::currentDateTime().toTime_t();
|
quint64 time = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
gnutls_x509_crt_set_activation_time(crt, time);
|
gnutls_x509_crt_set_activation_time(crt, time);
|
||||||
if (int result = gnutls_x509_crt_set_expiration_time(crt, time + 31536000L) != GNUTLS_E_SUCCESS) {
|
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));
|
error_ = QString("Failed to set the activation time of the certificate: %1").arg(gnutls_strerror(result));
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void ListenBrainzScrobbler::LoadSession() {
|
|||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
if (!refresh_token_.isEmpty()) {
|
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;
|
if (time < 6) time = 6;
|
||||||
refresh_login_timer_.setInterval(time * kMsecPerSec);
|
refresh_login_timer_.setInterval(time * kMsecPerSec);
|
||||||
refresh_login_timer_.start();
|
refresh_login_timer_.start();
|
||||||
@@ -318,7 +318,7 @@ void ListenBrainzScrobbler::AuthenticateReplyFinished(QNetworkReply *reply) {
|
|||||||
if (json_obj.contains("refresh_token")) {
|
if (json_obj.contains("refresh_token")) {
|
||||||
refresh_token_ = json_obj["refresh_token"].toString();
|
refresh_token_ = json_obj["refresh_token"].toString();
|
||||||
}
|
}
|
||||||
login_time_ = QDateTime::currentDateTime().toTime_t();
|
login_time_ = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
@@ -413,7 +413,7 @@ void ListenBrainzScrobbler::UpdateNowPlaying(const Song &song) {
|
|||||||
|
|
||||||
song_playing_ = song;
|
song_playing_ = song;
|
||||||
scrobbled_ = false;
|
scrobbled_ = false;
|
||||||
timestamp_ = QDateTime::currentDateTime().toTime_t();
|
timestamp_ = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
|
|
||||||
if (!song.is_metadata_good() || !IsAuthenticated() || app_->scrobbler()->IsOffline()) return;
|
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() {
|
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) {
|
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.source() == Song::Source_Stream && duration > 30) {
|
||||||
Song song(song_playing_);
|
Song song(song_playing_);
|
||||||
|
|||||||
Reference in New Issue
Block a user