The ages of pre-main-sequence stars