ListenBrainzScrobbler: Use std::max
This commit is contained in:
@@ -531,8 +531,7 @@ void ListenBrainzScrobbler::Error(const QString &error_message, const QVariant &
|
|||||||
|
|
||||||
void ListenBrainzScrobbler::CheckScrobblePrevSong() {
|
void ListenBrainzScrobbler::CheckScrobblePrevSong() {
|
||||||
|
|
||||||
qint64 duration = QDateTime::currentSecsSinceEpoch() - static_cast<qint64>(timestamp_);
|
const qint64 duration = std::max(0LL, QDateTime::currentSecsSinceEpoch() - static_cast<qint64>(timestamp_));
|
||||||
if (duration < 0) duration = 0;
|
|
||||||
|
|
||||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
||||||
Song song(song_playing_);
|
Song song(song_playing_);
|
||||||
|
|||||||
Reference in New Issue
Block a user