On Thu, Jul 23, 2026 at 3:43 PM Tomasz Kaminski <[email protected]> wrote:
> Hi, > > I just pushed the v2/2 patch, thanks again for contribution. As we are > closing to 16.2 > release I will not be able to look at your ostream patches soon (there are > some things > I want to double-check them). > > As a side note, in the v4 version that I merged, I removed passing of > locale > for sys_info, as the output is not really locally depended. I have > realized that the same > apply to any time_point that uses seconds (or greater precision). I wonder > if there would > be measurable benefit in defining operator<< for sys_time (utc_time, > etc...) as: > if constexpr (Duration::period::den == 1) > The condition should an or of treat_as_floating_point_v<Rep> || period.den == 1, as duration<float> contains subseconds even if it represents seconds. > chrono_write<64>(os, __t); > else > chrono_write<64>(os, __t, os.getloc()); > (Maybe we could have time_point_write with above, or time_point overload > of chrono_write). > > I think this also works for zoned_time, as the offset are defined in > seconds, so converting > will add subseconds. And hh_mm_ss. > > Is this something you would be interested in taking a look and measuring? > > Regards, > Tomasz > > > On Tue, Jul 14, 2026 at 5:35 AM Anlai Lu <[email protected]> wrote: > >> PING >> >> > On Jun 30, 2026, at 20:49, Anlai Lu <[email protected]> wrote: >> > >> > This is v3 of the patch series. Performance data: see v2 cover letter. >> > Results are unchanged -- same stack-buffer + __ostream_insert approach. >> > >> > Patch 1 is unchanged from v2. >> > >> > Changes in Patch 2 from v2: >> > >> > - Dropped the format string parameter from __chrono_write. >> > _S_empty_fs() is used directly, per Tomasz Kaminski's suggestion. >> > All chrono types now share the same two call forms: >> > __detail::__chrono_write(__os, __arg); >> > __detail::__chrono_write(__os, __arg, __os.getloc()); >> > >> > - Removed __detail::__empty_fmt: no longer needed. >> > >> > - All remaining operator<< that used basic_stringstream now use >> > __chrono_write (month_day, month_day_last, month_weekday, >> > month_weekday_last, year_month, year_month_day_last, >> > year_month_weekday, year_month_weekday_last, sys_days, local_time). >> > >> > - The only types not converted: duration (must forward stream flags >> > and precision) and local_info (uses __formatter_chrono_info). >> > >> > - Uses std::format_to_n (public API) instead of __do_vformat_to_n. >> > >> > Tested on x86_64-linux-gnu. libstdc++ testsuite (std/time/*) clean. >> > All converted types verified byte-identical across C, en_US, de_DE, >> > fr_FR, and zh_CN locales. >> > >> > Anlai Lu (2): >> > libstdc++: Add stream state tests for chrono operator<< >> > libstdc++: Use __chrono_write via _S_empty_fs for chrono ostream >> > insertion >> > >> > libstdc++-v3/include/bits/chrono_io.h | 227 ++++-------------- >> > .../testsuite/std/time/ostream_insert.cc | 163 +++++++++++++ >> > 2 files changed, 212 insertions(+), 178 deletions(-) >> > create mode 100644 libstdc++-v3/testsuite/std/time/ostream_insert.cc >> > >> > -- >> > 2.34.1 >> >>
