Chrono: add static method Cast()
This commit is contained in:
parent
1d00d55d53
commit
39542de69d
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue