DetachedSong: use std::chrono::duration for start_ms and end_ms

This commit is contained in:
Max Kellermann
2014-08-28 06:54:19 +02:00
parent 854258f376
commit 6ad933982f
12 changed files with 57 additions and 51 deletions

View File

@@ -28,11 +28,12 @@ DetachedSong::DetachedSong(const LightSong &other)
real_uri(other.real_uri != nullptr ? other.real_uri : ""),
tag(*other.tag),
mtime(other.mtime),
start_ms(other.start_ms), end_ms(other.end_ms) {}
start_time(SongTime::FromMS(other.start_ms)),
end_time(SongTime::FromMS(other.end_ms)) {}
DetachedSong::~DetachedSong()
{
/* this destructor exists here just so it won't get inlined */
/* this destructor exists here just so it won't inlined */
}
bool
@@ -60,8 +61,8 @@ DetachedSong::IsInDatabase() const
double
DetachedSong::GetDuration() const
{
if (end_ms > 0)
return (end_ms - start_ms) / 1000.0;
if (end_time.IsPositive())
return (end_time - start_time).ToDoubleS();
return tag.time - start_ms / 1000.0;
return tag.time - start_time.ToDoubleS();
}