aboutsummaryrefslogtreecommitdiffstats
path: root/src/Chrono.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-27 18:47:05 +0200
committerMax Kellermann <max@duempel.org>2014-08-27 18:47:14 +0200
commit58e6f660f3ff0abc77eb879814188809e9bf1995 (patch)
tree9674dbf6d142d0d3b70784e93a67c500587bd45e /src/Chrono.hxx
parentcd482ca6557c211043e3bd892bf75dab6c9ba92b (diff)
downloadmpd-58e6f660f3ff0abc77eb879814188809e9bf1995.tar.gz
mpd-58e6f660f3ff0abc77eb879814188809e9bf1995.tar.xz
mpd-58e6f660f3ff0abc77eb879814188809e9bf1995.zip
Chrono: add implicit conversion operator from std::chrono::duration
Diffstat (limited to 'src/Chrono.hxx')
-rw-r--r--src/Chrono.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Chrono.hxx b/src/Chrono.hxx
index e9edb8b09..4c9fafe58 100644
--- a/src/Chrono.hxx
+++ b/src/Chrono.hxx
@@ -37,6 +37,14 @@ public:
template<typename T>
explicit constexpr SongTime(T t):Base(t) {}
+ /**
+ * This constructor allows implicit conversion from the base
+ * class to this class. It is necessary because all of
+ * std::chrono::duration's operators return another
+ * std::chrono::duration and not an instance of this class.
+ */
+ constexpr SongTime(Base b):Base(b) {}
+
static constexpr SongTime FromS(unsigned s) {
return SongTime(rep(s) * 1000);
}