Chrono: add static method Cast()
This commit is contained in:
parent
1d00d55d53
commit
39542de69d
@ -42,6 +42,11 @@ public:
|
|||||||
return SongTime(Base::zero());
|
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) {
|
static constexpr SongTime FromS(unsigned s) {
|
||||||
return SongTime(rep(s) * 1000);
|
return SongTime(rep(s) * 1000);
|
||||||
}
|
}
|
||||||
@ -138,6 +143,11 @@ public:
|
|||||||
return SignedSongTime(-1);
|
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) {
|
static constexpr SignedSongTime FromS(int s) {
|
||||||
return SignedSongTime(rep(s) * 1000);
|
return SignedSongTime(rep(s) * 1000);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user