The connection between the second law of thermodynamics and the principle of microscopic reversibility