player/Control: convert `total_play_time` to `FloatDuration`

This commit is contained in:
Max Kellermann 2018-09-21 20:50:15 +02:00
parent 90f4e97751
commit 1a2012a97e
3 changed files with 4 additions and 4 deletions

View File

@ -120,7 +120,7 @@ stats_print(Response &r, const Partition &partition)
#else
(unsigned)std::chrono::duration_cast<std::chrono::seconds>(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;

View File

@ -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;
}

View File

@ -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