STD::CHRONO::DURATION(3cxx)
๐ std::chrono::duration< _Rep, _Period > ๐
okay so bestie, this is the manual page for std::chrono::duration< _Rep, _Period > from the C++ standard library, section 3cxx. it's literally the glow-up representation of a time distance between two points. i'm obsessed. โจ
๐ NAME ๐
std::chrono::duration< _Rep, _Period > โ chrono::duration represents a distance between two points in time. no cap. ๐
๐ธ SYNOPSIS ๐ธ
๐ Public Types
using period = typename _Period::typeโ this is the period type, the "tick" definition. it's giving "what's the unit, bestie?" energy. ๐ฐ๏ธusing rep = _Repโ the rep is the raw number type that holds the count. the main character of the arithmetic. ๐ข
๐ฆ Public Member Functions
template<typename _Rep2 , typename = _Require< is_convertible<const _Rep2&, rep>, __or_<__is_float<rep>, __not_<__is_float<_Rep2>>>>> constexpr duration (const _Rep2 &__rep)โ constructor from another rep. only works if the conversion is safe and you're not sneakily converting float to int. lowkey picky, highkey correct. ๐duration (const duration &)=defaultโ default copy constructor. slay, it's free. ๐ซถtemplate<typename _Rep2 , typename _Period2 , typename = _Require< is_convertible<const _Rep2&, rep>, __or_<__is_float<rep>, __and_<__is_harmonic<_Period2>, __not_<__is_float<_Rep2>>>>>> constexpr duration (const duration< _Rep2, _Period2 > &__d)โ constructor from a duration with a different rep and period. it's only allowed if the periods are harmonic and the rep conversion is chill. the vibe check is real. ๐constexpr rep count () constโ returns the raw count. the number of ticks. the literal tea. โtemplate<typename _Rep2 = rep> constexpr __enable_if_t<!treat_as_floating_point< _Rep2 >::value, duration & > operator%= (const duration &__d)โ modulo-assign by another duration. only if the rep isn't floating point. no floaties allowed here. ๐ซ๐template<typename _Rep2 = rep> constexpr __enable_if_t<!treat_as_floating_point< _Rep2 >::value, duration & > operator%= (const rep &__rhs)โ modulo-assign by a raw rep. same deal, no floating points. ๐constexpr duration & operator*= (const rep &__rhs)โ multiply-assign by a raw rep. scale that duration, periodt. ๐constexpr duration< typename common_type< rep >::type, period > operator+ () constโ unary plus. returns a duration with the common type of rep. it's giving "i'm positive" energy. โconstexpr duration & operator++ ()โ prefix increment. add one tick. go off. ๐ผconstexpr duration operator++ (int)โ postfix increment. returns the old value, then adds one tick. classic. ๐constexpr duration & operator+= (const duration &__d)โ add-assign another duration. stacking time. ๐งฑconstexpr duration< typename common_type< rep >::type, period > operator- () constโ unary minus. returns the negated duration with common rep type. toxic negativity but make it chrono. โconstexpr duration & operator-- ()โ prefix decrement. subtract one tick. lessgo. ๐ฝconstexpr duration operator-- (int)โ postfix decrement. returns old value, then subtracts one tick. the nostalgia. ๐constexpr duration & operator-= (const duration &__d)โ subtract-assign another duration. time subtraction, bestie. ๐งฎconstexpr duration & operator/= (const rep &__rhs)โ divide-assign by a raw rep. scaling down. ๐duration & operator= (const duration &)=defaultโ default copy assignment. iconic. ๐
๐ Static Public Member Functions
static constexpr duration max () noexceptโ returns the maximum duration. the biggest possible vibe. ๐static constexpr duration min () noexceptโ returns the minimum duration. the smallest possible vibe. ๐static constexpr duration zero () noexceptโ returns zero duration. the void. the beginning. the end. ๐ณ๏ธ
โญ Related Symbols
note: these are not member symbols, bestie. they're free functions that live outside the class. don't @ me. ๐
template<typename _Rep1 , typename _Period1 , typename _Rep2 , typename _Period2 > constexpr common_type< duration< _Rep1, _Period1 >, duration< _Rep2, _Period2 > >::type operator+ (const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)โ adds two durations with different reps and periods. returns the common type. the friendship bracelet of chrono. ๐คtemplate<typename _Rep1 , typename _Period , typename _Rep2 > constexpr duration< __common_rep_t< _Rep1, _Rep2 >, _Period > operator* (const duration< _Rep1, _Period > &__d, const _Rep2 &__s)โ multiplies a duration by a scalar. returns a duration with the common rep type and same period. math slay. โ๏ธtemplate<typename _Rep1 , typename _Period1 , typename _Rep2 , typename _Period2 > constexpr bool operator== (const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)โ equality comparison between two durations. returnsbool. are they the same? iykyk. ๐ฐ
๐ง Detailed Description ๐ง
template<typename _Rep, typename _Period>
class std::chrono::duration< _Rep, _Period >
chrono::duration represents a distance between two points in time. that's it. that's the tweet. it's literally the measure of time between two moments, and it's giving main character energy. ๐ซ
โจ Author โจ
generated automatically by Doxygen for libstdc++ from the source code. no human wrote this, but honestly? it ate. ๐
okay bestie, that's the whole page. this manual entry is from libstdc++ (the GNU C++ standard library), and it was auto-generated by Doxygen from the source code โ so you know it's official. now go measure some time, periodt. ๐ฐ๏ธ๐
๐ฆ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms