The aim of this article is to present algorithms to compute the firstconjugate time along a smooth extremal curve, where the trajectoryceases to be optimal. It is based on recent theoretical developmentsof geometric optimal control, and the article contains a reviewof second order optimality conditions.The computations are related to a testof positivity of the intrinsic second order derivative or a test ofsingularity of the extremal flow. We derive an algorithm called COTCOT(Conditions of Order Two and COnjugate Times), available on the web,and apply it to the minimal time problem of orbit transfer, and to theattitude control problem of a rigid spacecraft.This algorithm involves both normal and abnormal cases.