std::chrono::leap_second(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ std::chrono::leap_second(3) β€” C++ Standard Library ✨

okay bestie, buckle up, because we're talking about the manual page for std::chrono::leap_second in the C++ Standard Library, and it's giving tiny-but-mighty class energy πŸ•°οΈπŸ’…


πŸ“› NAME πŸ“›

std::chrono::leap_second β€” literally std::chrono::leap_second, that's the whole name, no notes, we love a self-titled icon πŸ‘‘


🌸 Synopsis 🌸

Defined in header <chrono>:

class leap_second;          (since C++20)

So the class leap_second represents the date and time of a leap second insertion. Yes, that kind of leap second. Timekeeping's favorite little plot twist ⏳✨

And here's the tea: users cannot construct leap_second objects except by copying from existing leap_second objects. No DIY, no "I'll just make one myself", none of that πŸ™…β€β™€οΈ The library implementation creates leap_second objects when it initializes the time zone database, and it provides const access to these objects. So you get to look, not touch β€” very museum exhibit, very "do not tap the glass" πŸ–ΌοΈπŸ‘€

Also, leap_second has a defaulted copy constructor and a defaulted copy assignment operator. Copying? Allowed. Vibes? Immaculate. 🫢


πŸ¦‹ Member functions πŸ¦‹

  • date β€” obtains the time of leap second insertion (public member function) πŸ—“οΈβœ¨

πŸ”₯ Nonmember functions πŸ”₯

These compare two leap_second values or a leap_second value and a sys_time β€” and they're a function template, ngl:

  • operator== β€” comparison bestie numero uno
  • operator< β€” the "less than" one
  • operator<= β€” the "less than or equal" one, yes it's real, yes it's here
  • operator> β€” the "greater than" one
  • operator>= β€” the "greater than or equal" one
  • operator<=> β€” the spaceship operator, (C++20) πŸš€βœ¨
They all do the comparing thing: two leap_second values, or a leap_second value and a sys_time. That's the assignment, and they ate. πŸ’―

πŸŽ€ Helper classes πŸŽ€

  • std::hash<std::chrono::leap_second> β€” hash support for std::chrono::leap_second (C++26) (class template specialization) πŸ”πŸ’–

okay that's the whole page, no cap. if you made it this far you're officially a chrono girly now, welcome to the club πŸ§šβ€β™€οΈπŸŒˆ

catch u later, this was brought to you by http://cppreference.com, version 2024.06.10, page std::chrono::leap_second(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from