std::liter...o_literals(3)

πŸ“¦ version 11.5.0, in centos-stream 9

πŸ’– NAME πŸ’–

okay so bestie, this is a Library Functions Manual page and the main character is std::literals::chrono_literals β€” literally the ISO C++ 2014 namespace for suffixes for duration literals. no cap, it's iconic.


✨ SYNOPSIS ✨

here's the whole function lineup, and every single one is a literal-suffix baddie:

🧚 Functions 🧚

  • template<char... _Digits> constexpr chrono::hours operator''h () β€” literal suffix for durations of type std::chrono::hours β€” it's giving hour energy fr fr.
  • constexpr chrono::duration< long double, ratio< 3600, 1 > > operator''h (long double __hours) β€” literal suffix for durations representing non-integer hours. floating-point girlies, this one's for you πŸ’….
  • template<char... _Digits> constexpr chrono::minutes operator''min () β€” literal suffix for durations of type std::chrono::minutes β€” minute-mode activated ✨.
  • constexpr chrono::duration< long double, ratio< 60, 1 > > operator''min (long double __mins) β€” literal suffix for durations representing non-integer minutes. cute AND precise πŸŽ€.
  • template<char... _Digits> constexpr chrono::milliseconds operator''ms () β€” literal suffix for durations of type std::chrono::milliseconds β€” tiny time units, huge vibe.
  • constexpr chrono::duration< long double, milli > operator''ms (long double __msecs) β€” literal suffix for durations representing non-integer milliseconds. yes bestie, fractional milli-time is real 😭.
  • template<char... _Digits> constexpr chrono::nanoseconds operator''ns () β€” literal suffix for durations of type std::chrono::nanoseconds β€” nano era, periodt.
  • constexpr chrono::duration< long double, nano > operator''ns (long double __nsecs) β€” literal suffix for durations representing non-integer nanoseconds. micro-level detail but make it nano πŸ’«.
  • template<char... _Digits> constexpr chrono::seconds operator''s () β€” literal suffix for durations of type std::chrono::seconds β€” the classic, the blueprint, the moment.
  • constexpr chrono::duration< long double > operator''s (long double __secs) β€” literal suffix for durations representing non-integer seconds. seconds but make it floaty πŸ¦‹.
  • template<char... _Digits> constexpr chrono::microseconds operator''us () β€” literal suffix for durations of type std::chrono::microseconds β€” micro queen behavior.
  • constexpr chrono::duration< long double, micro > operator''us (long double __usecs) β€” literal suffix for durations representing non-integer microseconds. tiny, specific, slaying πŸ’œ.

🌸 Detailed Description 🌸

so the whole vibe is: std::literals::chrono_literals is the ISO C++ 2014 namespace for suffixes for duration literals. ✨

these suffixes can be used to create 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 after making the suffix visible in the current scope. shortcut era, honestly.

the suffixes can be made visible by a using-directive or using-declaration such as:

  • 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). and yes, "unspecified" is doing a lot of work there β€” don't come for me, that's literally what the page says πŸ‘€.


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. 😭 no human author, just Doxygen doing its thing.


xoxo, bestie πŸ’– this iconic page is from libstdc++, dated Wed Oct 7 2026, and it's the std::liter...o_literals(3) page. slay.

πŸ“¦ where this page comes from