change the time-diff function