share code for calculation of relative times in log