summaryrefslogtreecommitdiff
path: root/src/db/Stats.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-29 23:22:46 +0200
committerMax Kellermann <max@duempel.org>2014-08-29 23:25:03 +0200
commit58352ea69d3e40bd3c91eacc7bbd48f58d5f2c8a (patch)
tree98b0f981114a98177e7cb805cefa6c1c335dd6fd /src/db/Stats.hxx
parentde64b35359dff6f052aee4b38042c0d91ae5aefb (diff)
db/Stats: use std::chrono::duration for the total duration
Use milliseconds precision to reduce rounding errors.
Diffstat (limited to 'src/db/Stats.hxx')
-rw-r--r--src/db/Stats.hxx6
1 files changed, 4 insertions, 2 deletions
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<std::uint64_t, SongTime::period> 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;
}
};