db/Stats: use std::chrono::duration for the total duration

Use milliseconds precision to reduce rounding errors.
This commit is contained in:
Max Kellermann
2014-08-29 23:22:46 +02:00
parent de64b35359
commit 58352ea69d
4 changed files with 11 additions and 6 deletions

View File

@@ -99,15 +99,18 @@ db_stats_print(Client &client, const Database &db)
if (!stats_update(db))
return;
unsigned total_duration_s =
std::chrono::duration_cast<std::chrono::seconds>(stats.total_duration).count();
client_printf(client,
"artists: %u\n"
"albums: %u\n"
"songs: %u\n"
"db_playtime: %lu\n",
"db_playtime: %u\n",
stats.artist_count,
stats.album_count,
stats.song_count,
stats.total_duration);
total_duration_s);
const time_t update_stamp = db.GetUpdateStamp();
if (update_stamp > 0)