added a function to calculate time diffs in seconds