Repository navigation
: Fix formatting for unusual durations - #3649
Stephan T. Lavavej (StephanTLavavej) merged 11 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Currently no implementation correctly formats However, it seems that [time.format] doesn't say |
|
Wait, actually, I'm trying to understand the UB here... could you write up an example? |
I attempted to test formatting Reduced example that contains needed runtime operations and fails to compile due to integer overflow (Godbolt link): #include <chrono>
#include <cstdint>
#include <limits>
#include <ratio>
#include <type_traits>
using LongRatio = std::ratio<INT64_MAX - 1, INT64_MAX>;
using D = std::chrono::duration<int, LongRatio>;
constexpr auto weird40 = D{40};
constexpr auto cast_to_day = std::chrono::duration_cast
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
Thanks! I pushed a conflict-free merge with |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
We forgot to defend |
|
Thanks for investigating and fixing this bug! ⌚ 🎉 😸 |
Fixes #3644.
hh_mm_ss<_Duration>seems wrong for_Hh_mm_ss_part_underflow_to_zeroto me.Need to explore how to accept
duration>. Currently libstdc++ rejects it, while libc++ accepts it (Godbolt link).Edit: the current approach for calculation of
hh_mm_ss::fractional_width doesn't seem right. I'm trying to fix it.Edit 2: now the formatting is made well-formed, but UB may happen.