Timer fixes

Hello,

Here are various timer bug fixes and a new function that was needed for timing managements in connection state.