mercredi 11 mai 2022

std::time() and its dependence on daylight saving

I have a requirement to lock a user, if 3 consecutive login attempts are failed within 15 minutes. I am going to check with the following formula, if third login attempt fails.

    if (first_login_attemp_time + 900 <= std::time(nullptr))
    {
        lockuser();
    }

If the first login attempt fails, I set first_login_attemp_time as given below

first_login_attemp_time = std::time(nullptr)

Will this code work if daylight saving time change occurs in the 15 minutes window? Should I consider something else for day light saving?

Aucun commentaire:

Enregistrer un commentaire