std::chrono...::sys_time)(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 std::chrono::operator<<(std::chrono::sys_time) πŸ’…

okay bestie, welcome to the C++ Standard Library manual, section 3 β€” and yeah, the header spells it C++ Standard Libary, so we're letting that typo have its main character moment πŸ’€. This page is from the C++ Standard Library manual and it's all about std::chrono::operator<<(std::chrono::sys_time) β€” chrono stream operator vibes, no cap. πŸ•°οΈβœ¨

🌸 NAME 🌸

std::chrono::operator<<(std::chrono::sys_time) β€” and yep, the name is literally repeated: std::chrono::operator<<(std::chrono::sys_time). that's the whole name, bestie. πŸ’–

πŸ“‹ Synopsis πŸ“‹

Defined in header <chrono> ✨

template< class CharT, class Traits, class Duration >

std::basic_ostream<CharT, Traits>&                           (1)
(since C++20)
operator<<( std::basic_ostream<CharT, Traits>& os,

            const std::chrono::sys_time<Duration>& tp );
template< class CharT, class Traits, class Duration >

std::basic_ostream<CharT, Traits>&                           (2)
(since C++20)
operator<<( std::basic_ostream<CharT, Traits>& os,

            const std::chrono::sys_days& tp );

Outputs tp into the stream os. 🫢

1) Equivalent to:

return os << std::format(os.getloc(), STATICALLY-WIDEN<CharT>("{:L%F %T}"), tp);

where STATICALLY_WIDEN<CharT>("{:L%F %T}") is "{:L%F %T}" if CharT is char, and L"{:L%F %T}" if CharT is wchar_t.

This overload participates in overload resolution only if std::chrono::treat_as_floating_point_v<typename Duration::rep> is false and Duration(1) < std::chrono::days(1).

2) Equivalent to os << std::chrono::year_month_day(tp);.

πŸ’– Return value πŸ’–

os β€” that's it, that's the return value, bestie. 🫢

🩹 Defect reports 🩹

The following behavior-changing defect reports were applied retroactively to previously published C++ standards:

  • DR: P2372R3
  • Applied to: C++20
  • Behavior as published: the given locale was used by default
  • Correct behavior: L is needed to use the given locale

πŸ‘€ See also πŸ‘€

  • std::formatter<std::chrono::sys_time> β€” formatting support for sys_time (C++20) (class template specialization) 🌈
  • format β€” stores formatted representation of the arguments in a new string (C++20) (function template) ✨
  • operator<< β€” outputs a year_month_day into a stream (C++20) (function template) πŸ’…

mwah πŸ’‹ source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::chrono...::sys_time)(3).

πŸ“¦ where this page comes from