sort stages by time