Skip to content

Improve documentation of ntp.datetime access behavior and exceptions #23

Closed
@jdimpson

Description

@jdimpson

I've been running this on a qt-py-esp32-s2 for a couple days and had intermittent random code failures. It turns out that very occasionally the NTP response wasn't coming back within socket_timeout seconds, which manifested as an OSError exception that caused my code.py to exit. Took a while to recreate but fairly obvious how to fix.

In order to save others the time of having to recreate the problem in order to witness it in the REPL, I'd like to add some words to the inline documentation about both how 1) accesses to ntp.datetime are what cause the NTP request to be sent, and therefore 2) accesses to ntp.datetime may throw an OSError exception, which should be caught and handled appropriately. I will (attempt to) open a PR with these changes.

Thanks for making this NTP code. It was just what I needed for my project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions