A simple logic solution is ..
Code:
vec_to_ang(tmp2.pan,tmp1);
if(sign(tmp2.pan) < 0)
tmp2.pan +=360;
if(sign(tmp2.tilt) < 0)
tmp2.tilt += 360;
if(sign(tmp2.roll) < 0 )
tmp2.roll += 360;