Provide true clock-modulus operation for arbitrary sign values
Style comments:


Generic typename T implies you do not know or care what kind of type it is or which properties it has. Why not name it Numeric or something in that direction?
You should really use better names for variables. At first glance, no one has any idea what which variable is intended to do.
Even a single line if deserves braces. When omitting these and later adding to the code, programmers often forget to add them and introduce bugs.
typedef is a relic of C compatibility. Consider the using keyword instead.
Do not just arbitrary rename a type especially into something like D. You have an IDE it can do completion for you, use it. (And yes, even vim and emacs do completion, no excuses unless you write your code in notepad.)
Comment on your intentions and assumptions of the pieces of your code.


Solution issues:


  the sign of v indicates the 'direction of counting' round the clock, positive increments from 0, negative decrements from m



You are probably looking for this, meaning you should declare the template function and then offer specific implementations for the different possible instances of T.
Is a cast to long double really required? If T is a numeric type, all required operations should be defined for T. There is no reason to fall back to std::fabs().
If you want to do it by hand, I would suggest something in the way of

bool clockwise = (v &gt;= 0);
T absolute_v;
if(!clockwise){ // !clockwise implies v &lt; 0
    absolute_v = -v; // we want the abs(v)
} else {
    absolute_v = v;
}