`boost::posix_time::duration` multiplication/division limited to `int`.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start in include/boost/date_time/time_duration.hpp at the operator overloads linked in the issue, and reproduce the unsigned multiplication example with BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG enabled. Compare the current int behavior with the requested unsigned or 64-bit support and verify that the resulting duration preserves the expected nanosecond total.
Written by the indexing model from the issue text.
Description
The operator*(), operator*=(), operator/(), and operator/=() currently only support int parameters [see boost::posix_time::duration].
I tried to use it as follows:
std::uint64_t const timedeltaInTensOfNanoseconds = 2793555578;
boost::posix_time::time_duration const duration = boost::posix_time::nanoseconds(10) * timestamp;
// duration.total_nanoseconds() = -15014117180
[I did define BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG.]
What did work as expected was:
std::uint64_t const timedeltaInTensOfNanoseconds = 2793555578;
boost::posix_time::time_duration const duration = boost::posix_time::nanoseconds(10 * timestamp);
// duration.total_nanoseconds() = 27935555780
Would it be possible to extend the parameter type for above functions to at least support unsigned as well? Or even extend it to 64-bit types? Or make them template-methods [with a concept limiting them to ints and floats]?
- Dominant language
- C++
- Stars
- 70
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/date_time
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in boostorg/date_time
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·