From 58352ea69d3e40bd3c91eacc7bbd48f58d5f2c8a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2014 23:22:46 +0200 Subject: db/Stats: use std::chrono::duration for the total duration Use milliseconds precision to reduce rounding errors. --- src/db/Stats.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/db/Stats.hxx') diff --git a/src/db/Stats.hxx b/src/db/Stats.hxx index 107af9d5f..131a5dc47 100644 --- a/src/db/Stats.hxx +++ b/src/db/Stats.hxx @@ -20,6 +20,8 @@ #ifndef MPD_DATABASE_STATS_HXX #define MPD_DATABASE_STATS_HXX +#include "Chrono.hxx" + struct DatabaseStats { /** * Number of songs. @@ -29,7 +31,7 @@ struct DatabaseStats { /** * Total duration of all songs (in seconds). */ - unsigned long total_duration; + std::chrono::duration total_duration; /** * Number of distinct artist names. @@ -43,7 +45,7 @@ struct DatabaseStats { void Clear() { song_count = 0; - total_duration = 0; + total_duration = total_duration.zero(); artist_count = album_count = 0; } }; -- cgit v1.2.3