Getting duration units??

Apr 13, 2016 at 6:15pm
Hi,

If you have a
time_point
, is there a way to find out what units of
duration
it uses?

Thanks,
Juan
Apr 14, 2016 at 3:10am
1
2
3
4
5
6
template < typename TIME_POINT > constexpr double ticks_per_second()
{
    using duration = typename TIME_POINT::duration ;
    using period = typename duration::period ;
    return double(period::den) / period::num ;
}

http://coliru.stacked-crooked.com/a/b79e7da4d18bd2da
Topic archived. No new replies allowed.