Is this a conforming implementation of duration_cast?
I can't say for sure about the internal logic but I can point some problems or things that could be improved in your piece of code:


First of all, typename is missing before the names, making your code non-working with some compilers. I would also use using instead of typedef, but that's a mere matter of taste. Updated version:

using ratio = typename std::ratio_divide&lt;Period, typename ToUnit::period&gt;::type;
using common_type = std::common_type&lt;typename std::common_type&lt;typename ToUnit::rep, Rep&gt;::type, intmax_t&gt;::type;

std::common_type is variadic. You don't have to bother with nested std::common_types:

using common_type = typename std::common_type&lt;typename ToUnit::rep, Rep, intmax_t&gt;::type;

I know that MSVC has not a full support for constexpr, but duration_cast is supposed to be constexpr (it should work with the November 2013 CTP though):

template&lt;typename ToUnit, typename Rep, typename Period&gt;
constexpr ToUnit duration_cast_2(const std::chrono::duration&lt;Rep, Period&gt;&amp; right)
{
    // ...
}