Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Durations of full days have 0 total_seconds (PyPy) #876

Open
2 tasks done
tammoippen opened this issue Jan 22, 2025 · 0 comments
Open
2 tasks done

Durations of full days have 0 total_seconds (PyPy) #876

tammoippen opened this issue Jan 22, 2025 · 0 comments

Comments

@tammoippen
Copy link

  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: OS X 15.2 Sequoia
  • Pendulum version: 3.0.0 (and also installing from git)
  • Python version: 3.10.14 (PyPy 7.3.17)

Issue

There is an issue with durations of full days with the latest Pendulum version and PyPy.

Here is a reproducer in ipython:

> ipython
Python 3.10.14 (39dc8d3c85a7, Aug 27 2024, 20:40:24)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pendulum import duration

In [2]: duration(days=1)
Out[2]: Duration()

In [3]: duration(hours=23)
Out[3]: Duration(hours=23)

In [4]: duration(minutes=24*60)
Out[4]: Duration()

In [5]: duration(seconds=24*60*60)
Out[5]: Duration()

In [6]: duration(days=1).total_seconds()
Out[6]: 0.0

In [7]: duration(days=2).total_seconds()
Out[7]: 0.0

In [8]: duration(days=2, minutes=1).total_seconds()
Out[8]: 60.0

# there is no problem with the native timedelta of pypy
In [8]: from datetime import timedelta

In [9]: timedelta(days=1).total_seconds()
Out[9]: 86400.0
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

No branches or pull requests

1 participant