Skip to content

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

Open
@tammoippen

Description

@tammoippen
  • 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

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