diff options
author | Max Kellermann <max@duempel.org> | 2014-08-28 06:54:19 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-28 13:03:18 +0200 |
commit | 6ad933982f68f5fcbd1b3179bf5fed26f63aa792 (patch) | |
tree | f0aee7be7dd2caba5a795602bf519739ed6cefc0 /src/DetachedSong.cxx | |
parent | 854258f37626d40271a821d4835e9cfb946c8ad8 (diff) | |
download | mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.tar.gz mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.tar.xz mpd-6ad933982f68f5fcbd1b3179bf5fed26f63aa792.zip |
DetachedSong: use std::chrono::duration for start_ms and end_ms
Diffstat (limited to '')
-rw-r--r-- | src/DetachedSong.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx index eb377e591..752578430 100644 --- a/src/DetachedSong.cxx +++ b/src/DetachedSong.cxx @@ -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(); } |