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

rust: Use i64 for internal unix timestamps #842

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 23, 2024

  1. rust: Use i64 for internal unix timestamps

    pendulum 3.0.0 fails to build on 32-bit armhf:
    
    ```
    error: this arithmetic operation will overflow
      --> src/helpers.rs:59:20
       |
    59 | seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `135140_usize * 86400_usize`, which would overflow
       |
       = note: `#[deny(arithmetic_overflow)]` on by default
    ```
    
    `(146_097 - 10957) * SECS_PER_DAY` equals 11,676,096,000 which does not
    fit into 32 bit integers.
    
    Use i64 for the seconds variable while handling with the timestamp. Only
    convert in to `usize` once the timestamp is split into its components.
    
    Fixes sdispater#784
    Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/pendulum/+bug/2079029
    bdrung committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    6f2fcb8 View commit details
    Browse the repository at this point in the history