Skip to content

refactor: transition to UTC-aware datetimes #477

Description

@shbatm

Currently, pyisy.helpers.now() and ntp_to_system_time() return naive datetimes, often reflecting the local system clock. As part of modernizing the library to Python 3.11+ standards, we should transition these to return UTC-aware datetimes using datetime.UTC.

Considerations:

  • This is a breaking change for consumers that perform arithmetic with these values and expect naive objects.
  • It will shift last_changed, last_update, and last_edited values by the local UTC offset for consumers treating them as wall-clock time.
  • A CHANGELOG entry and potentially a major version bump (or a very clear migration path) will be required.

Proposed Change:

  • Update now() to use datetime.datetime.now(datetime.UTC).
  • Update ntp_to_system_time() to attach datetime.UTC.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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