diff --git a/src/Stats.cxx b/src/Stats.cxx index df3b78148..0ba5d6b85 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -120,7 +120,7 @@ stats_print(Response &r, const Partition &partition) #else (unsigned)std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count(), #endif - (unsigned long)(partition.pc.GetTotalPlayTime() + 0.5)); + (unsigned long)(partition.pc.GetTotalPlayTime().count() + 0.5)); #ifdef ENABLE_DATABASE const Database *db = partition.instance.database; diff --git a/src/player/Control.hxx b/src/player/Control.hxx index 063d4b266..f2a85ce2a 100644 --- a/src/player/Control.hxx +++ b/src/player/Control.hxx @@ -231,7 +231,7 @@ class PlayerControl final : public AudioOutputClient { const ReplayGainConfig replay_gain_config; - double total_play_time = 0; + FloatDuration total_play_time = FloatDuration::zero(); public: PlayerControl(PlayerListener &_listener, @@ -580,7 +580,7 @@ public: replay_gain_mode = _mode; } - double GetTotalPlayTime() const noexcept { + auto GetTotalPlayTime() const noexcept { return total_play_time; } diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 008b03c11..9be121cb7 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -766,7 +766,7 @@ PlayerControl::PlayChunk(DetachedSong &song, MusicChunkPtr chunk, const double chunk_length(chunk->length); outputs.Play(std::move(chunk)); - total_play_time += chunk_length / format.GetTimeToSize(); + total_play_time += FloatDuration(chunk_length / format.GetTimeToSize()); } inline bool