aboutsummaryrefslogtreecommitdiffstats
path: root/src/DetachedSong.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/DetachedSong.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx
index fd81545c3..906e29bba 100644
--- a/src/DetachedSong.cxx
+++ b/src/DetachedSong.cxx
@@ -58,11 +58,16 @@ DetachedSong::IsInDatabase() const
return !uri_has_scheme(_uri) && !PathTraitsUTF8::IsAbsolute(_uri);
}
-double
+SignedSongTime
DetachedSong::GetDuration() const
{
- if (end_time.IsPositive())
- return (end_time - start_time).ToDoubleS();
+ SongTime a = start_time, b = end_time;
+ if (!b.IsPositive()) {
+ if (tag.duration.IsNegative())
+ return tag.duration;
- return tag.time - start_time.ToDoubleS();
+ b = SongTime(tag.duration);
+ }
+
+ return SignedSongTime(b - a);
}