https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114240

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
>        using __format::_ChronoParts;
>        auto __need = _ChronoParts::_Year | _ChronoParts::_Month
> -                   | _ChronoParts::_Day | _ChronoParts::_TimeOfDay;
> +                   | _ChronoParts::_Day;
> +      if constexpr (ratio_less_v<typename _Duration::period, days::period>)
> +       __need |= _ChronoParts::_TimeOfDay;

This condition's not right.

If we have a period of days, but a floating-point rep, we probably do want to
parse and use a time if one is present in the input. "2024-03-07 00:05" can be
represented by sys_time<duration<double, days::period>> and is not the same
time as "2024-03-07".

And if we have a period like ratio<days::period::num+1, 1> then it's greater
than days, but not using the time of day in the result will lose accuracy.

I'm leaning towards Howard's approach of just assuming 00:00:00 if no time is
present, rather than making it depend on the period in any way.

Reply via email to