From 7c25d83f1cc4c7db2d2d3f4506525dd056b885e8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2014 12:14:27 +0200 Subject: Tag: use SignedSongTime for the song duration --- src/db/Count.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/db/Count.cxx') 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; } -- cgit v1.2.3