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 https://github.com/sdispater/pendulum/issues/784
Pull Request Check List
- [ ] Added tests for changed code.
- [ ] Updated documentation for changed code.
CodSpeed Performance Report
Merging #842 will not alter performance
Comparing bdrung:32-bit (f2b0351) with master (83db0b9)
Summary
✅ 1 untouched benchmarks
Thank you for your patch.
Please rebase your changes with master to fix the failing pipeline
Rebased on master.
Thank you for the fix