Goal is to be compatible with apps like "Google Authenticator", to be compatible with most of the existing apps that means supporting TOTP with 6 digits, SHA1 as algorithm and a new code each 30 seconds. A code from the previous period or the next period (P-1 and P+1) should be considered valid to not harm too much the usability, 30 seconds could be short otherwise if the server or the user are not perfectly synced.
RFC6238 TOTP: Time-Based One-Time Password Algorithm
https://tools.ietf.org/html/rfc6238
Also check errata ID 2866 for the test vectors
https://www.rfc-editor.org/errata_search.php?eid=2866