Time measurement code.