std::liter...o_literals(3)

πŸ’– NAME πŸ’–

okay bestie, welcome to the std::liter...o_literals(3) page β€” this one lives in the Library Functions Manual and its whole name is std::literals::chrono_literals ✨


🌸 SYNOPSIS 🌸

πŸŽ€ Functions πŸŽ€

  • constexpr chrono::day operator''d (unsigned long long __d) noexcept β€” the literal suffix that hands you a chrono::day object, no cap.
  • template<char... _Digits> constexpr chrono::hours operator''h () β€” literal suffix for durations of type std::chrono::hours.
  • constexpr chrono::duration< long double, ratio< 3600, 1 > > operator''h (long double __hours) β€” literal suffix for durations that are hours but make it non-integer πŸ’…
  • template<char... _Digits> constexpr chrono::minutes operator''min () β€” literal suffix for durations of type std::chrono::minutes.
  • constexpr chrono::duration< long double, ratio< 60, 1 > > operator''min (long double __mins) β€” literal suffix for durations representing non-integer minutes.
  • template<char... _Digits> constexpr chrono::milliseconds operator''ms () β€” literal suffix for durations of type std::chrono::milliseconds.
  • constexpr chrono::duration< long double, milli > operator''ms (long double __msecs) β€” literal suffix for durations representing non-integer milliseconds.
  • template<char... _Digits> constexpr chrono::nanoseconds operator''ns () β€” literal suffix for durations of type std::chrono::nanoseconds.
  • constexpr chrono::duration< long double, nano > operator''ns (long double __nsecs) β€” literal suffix for durations representing non-integer nanoseconds.
  • template<char... _Digits> constexpr chrono::seconds operator''s () β€” literal suffix for durations of type std::chrono::seconds.
  • constexpr chrono::duration< long double > operator''s (long double __secs) β€” literal suffix for durations representing non-integer seconds.
  • template<char... _Digits> constexpr chrono::microseconds operator''us () β€” literal suffix for durations of type std::chrono::microseconds.
  • constexpr chrono::duration< long double, micro > operator''us (long double __usecs) β€” literal suffix for durations representing non-integer microseconds.
  • constexpr chrono::year operator''y (unsigned long long __y) noexcept β€” the literal suffix for creating chrono::year objects πŸ—“οΈ

πŸ¦‹ Detailed Description πŸ¦‹

it's giving ISO C++ 2014 namespace energy β€” this is the namespace that holds all the suffixes for duration literals 🫢

so like, these suffixes let you build chrono::duration values with tick periods of hours, minutes, seconds, milliseconds, microseconds or nanoseconds. for example, std::chrono::seconds(5) can be written as 5s once you've made the suffix visible in the current scope. you make the suffixes visible with a using-directive or using-declaration, like one of these iconic options:

  • using namespace std::chrono_literals;
  • using namespace std::literals;
  • using namespace std::chrono;
  • using namespace std;
  • using std::chrono_literals::operator""s;

the result of these suffixes on an integer literal is one of the standard typedefs, such as std::chrono::hours. the result on a floating-point literal is a duration type with the specified tick period and an unspecified floating-point representation β€” for example, 1.5e2ms might be equivalent to chrono::duration<long double, chrono::milli>(1.5e2) ✨

⭐ Since ⭐

C++14 β€” she's been here a minute and she ate πŸ”₯

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. the robots wrote this one, we just added the sparkle πŸ™ˆ


reminder bestie: using namespace std; is a whole vibe in a tiny file but a menace in a big one β€” it's literally listed up there as a way to do it, so do with that information what you will πŸ’€

that's the whole page fr fr πŸ’– this one comes to you from libstdc++ (the footer's other half is just the page title again, no date on the tin, so we're keeping it cute and undated) β€” mwah, go write some 5s and slay πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms