I am using Boost.Units to try and compute the number of samples in a time interval, given the sample rate. Given this code:
typedef make_scaled_unit<si::frequency, scale<10, static_rational<3> > >::type kilohertz_unit;
typedef make_scaled_unit<si::time, scale<10, static_rational<-6> > >::type microseconds_unit;
<code>
template <typename T=unsigned>
using Kilohertz = quantity<kilohertz_unit,T>;
template <typename T=unsigned>
using Microseconds = quantity<microseconds_unit,T>;
// Using boost::rational as the value type neatly avoids overflows
Kilohertz<rational<unsigned>> sample_rate(125*si::kilo*si::hertz);