To observe multiple asteroids in a short time, the time-optimal reorientation is investigated here for the restto-rest reorientation of a generic rigid spacecraft. First, the problem is formulated and solved using the hp-adaptive pseudospectral method. It is found that there exist not merely bang-bang but also singular solutions for the problem. Then, the bang-bang and singular solutions are discussed by various cases. The results reveal that the optimal solution is essentially a balance between the larger torque, the shorter angular path and the less moment of inertia. For bang-bang solutions, the total number of switches varies with the reorientation angle and the moment of inertia. The number of switches is usually 5 or 6 and does not exceed 8. For singular solutions, either one and two controls singular are possible. The singular optimal solution is probably optimal for the slender rod-like spacecraft. Finally, an analytical estimation method is proposed for determining the range of the optimal time. The results of the simulations indicate that the proposed method is real-time and highly accurate. All formulas of this paper are derived in canonical units and therefore apply to any rigid spacecraft.