std::liter...o_literals(3)
π 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 typestd::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 typestd::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 typestd::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 typestd::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 typestd::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 typestd::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
- centos-stream 9: libstdc++-docs 11.5.0-16.el9 Β· GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms