A protostar becomes a main sequence star when its core temperature exceeds 10 million K. This is the temperature needed for hydrogen fusion to operate efficiently. The length of time all of this takes depends on the mass of the star. The more massive the star, the faster everything happens.