Fixed time difference calculation - fixes #18