New method of measuring relaxation times in semiconductors