std::chrono::leap_second(3)
β¨ 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 unooperator<β the "less than" oneoperator<=β the "less than or equal" one, yes it's real, yes it's hereoperator>β the "greater than" oneoperator>=β the "greater than or equal" oneoperator<=>β the spaceship operator, (C++20) πβ¨
They all do the comparing thing: twoleap_secondvalues, or aleap_secondvalue and asys_time. That's the assignment, and they ate. π―
π Helper classes π
std::hash<std::chrono::leap_second>β hash support forstd::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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms