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. ๐Ÿ•ณ๏ธ
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. returns bool. 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