Skip to content

Replace custom time handling with datetime/timedelta #1336

Description

@jacalata

From #1299:

The use of a custom datetime module caught me off guard in the project.
I'd suggest using datetime and timedelta as the source for seconds and minutes instead of manually keeping track of what the seconds and minutes ought to be, but didn't want to make any more changes than necessary to fix the problem.

Activity

  1. github-actions commented on Jul 28, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.

  2. jacalata commented on Aug 25, 2026

    @jacalata
    ContributorAuthor

    Would be nice to have — PRs welcome to swap the raw time.time() / time.sleep() in exponential_backoff.py for datetime.timedelta.

  3. added
    help wantedA user needs help, may be a mistake, a bug or a feature request
    and removed on Aug 25, 2026
  4. jacalata commented on Aug 27, 2026

    @jacalata
    ContributorAuthor

    Adding a datapoint from the recent cloud-schedule parsing work in #1875: datetime_helpers.parse_datetime had to grow a second strptime branch to accept the Cloud form 2026-08-29T16:55:00-0700 alongside Server's ...Z.

    datetime.fromisoformat would collapse both into a one-liner — but not until we drop 3.10:

    • Python 3.11+ accepts both ...Z and unpunctuated offsets like -0700 natively.
    • Python 3.10 rejects Z and requires punctuated offsets (-07:00), so the swap would still need a preprocessing shim — no cleaner than the current two-strptime pattern.

    Once requires-python bumps past 3.10 (EOL 2026-10), parse_datetime becomes datetime.fromisoformat(s) and TABLEAU_CLOUD_DATE_FORMAT / the try/except ValueError fallback can be deleted. Flagging so it doesn't get lost.

  5. jacalata commented on Sep 5, 2026

    @jacalata
    ContributorAuthor

    Closing as won't-fix rather than stale. On closer inspection (see #1876) the refactor turns out to be cosmetic — (datetime.now() - self.start_time).total_seconds() works the same way as time.time() - self.start_time, nothing downstream uses timedelta types, both APIs are equally subject to wall-clock jumps. Sorry for the earlier "PRs welcome" mixed signal.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions