Skip to content

Consider changing socketTimeout to milliseconds #33

@hmueller01

Description

@hmueller01

As @TD-er mentioned in #32 change socketTimeout internal from seconds to milliseconds to avoid the multiplication every time.


However there is still something odd:

    if (currentMillis - previousMillis >= this->socketTimeout * 1000UL) {
        return false;
    }

Why consider the socketTimeout as seconds here?

It isn't a bug, just odd as you now need to multiply it with 1000 every time you want to check it.


API would not change by this way:

PubSubClient& PubSubClient::setSocketTimeout(uint16_t timeout) {
    this->socketTimeout = timeout * 1000UL;
    return *this;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions