aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/Count.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-29 12:14:27 +0200
committerMax Kellermann <max@duempel.org>2014-08-29 13:20:58 +0200
commit7c25d83f1cc4c7db2d2d3f4506525dd056b885e8 (patch)
treeb710e3f3d0f4edf7de0dcf6d61c823d8da7c9027 /src/db/Count.cxx
parent8ce30c6a69a64f37a866541f66e3f242fe901f49 (diff)
downloadmpd-7c25d83f1cc4c7db2d2d3f4506525dd056b885e8.tar.gz
mpd-7c25d83f1cc4c7db2d2d3f4506525dd056b885e8.tar.xz
mpd-7c25d83f1cc4c7db2d2d3f4506525dd056b885e8.zip
Tag: use SignedSongTime for the song duration
Diffstat (limited to 'src/db/Count.cxx')
-rw-r--r--src/db/Count.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/db/Count.cxx b/src/db/Count.cxx
index 4fd53a73b..fecd901e5 100644
--- a/src/db/Count.cxx
+++ b/src/db/Count.cxx
@@ -64,7 +64,10 @@ static bool
stats_visitor_song(SearchStats &stats, const LightSong &song)
{
stats.n_songs++;
- stats.total_time_s += song.GetDuration();
+
+ const auto duration = song.GetDuration();
+ if (!duration.IsNegative())
+ stats.total_time_s += duration.ToS();
return true;
}
@@ -79,8 +82,8 @@ CollectGroupCounts(TagCountMap &map, TagType group, const Tag &tag)
SearchStats()));
SearchStats &s = r.first->second;
++s.n_songs;
- if (tag.time > 0)
- s.total_time_s += tag.time;
+ if (!tag.duration.IsNegative())
+ s.total_time_s += tag.duration.ToS();
found = true;
}