Add t interval calculation function