Commit 39542de6 authored by Max Kellermann's avatar Max Kellermann

Chrono: add static method Cast()

parent 1d00d55d
......@@ -42,6 +42,11 @@ public:
return SongTime(Base::zero());
}
template<typename D>
static constexpr SongTime Cast(D src) {
return SongTime(std::chrono::duration_cast<Base>(src));
}
static constexpr SongTime FromS(unsigned s) {
return SongTime(rep(s) * 1000);
}
......@@ -138,6 +143,11 @@ public:
return SignedSongTime(-1);
}
template<typename D>
static constexpr SongTime Cast(D src) {
return SongTime(std::chrono::duration_cast<Base>(src));
}
static constexpr SignedSongTime FromS(int s) {
return SignedSongTime(rep(s) * 1000);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment