Skip to content

Keep duration microseconds exact for large values - #1003

Open
gyanu2507 wants to merge 1 commit into
python-pendulum:masterfrom
gyanu2507:fix/duration-microsecond-precision
Open

Keep duration microseconds exact for large values#1003
gyanu2507 wants to merge 1 commit into
python-pendulum:masterfrom
gyanu2507:fix/duration-microsecond-precision

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 6, 2026

Copy link
Copy Markdown

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

Duration rebuilt _microseconds from total_seconds(), which is a float, so a value like 8999999999999999 came back as 999998 instead of 999999 (what datetime.timedelta returns). The constructor now splits days/seconds/microseconds from timedelta's integer fields.

Fixes #332

Duration rebuilt _microseconds from total_seconds(), a float, so
counts like 8999999999999999 rounded to 999998 instead of 999999.
Split from timedelta's integer fields instead.

Fixes python-pendulum#332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

duration loses microsecond precision on large values

1 participant