std::chrono...t_local_time(3)
okay bestie, this is std::chrono...t_local_time(3) from the C++ Standard Libary manual β the whole vibe is std::chrono::nonexistent_local_time, and weβre about to understand it fr fr π°οΈβ¨
π NAME π
std::chrono::nonexistent_local_time β std::chrono::nonexistent_local_time
πΈ Synopsis πΈ
Defined in header <chrono>:
class nonexistent_local_time; (since C++20)
Defines a type of object to be thrown as exception to report that an attempt was made to convert a nonexistent std::chrono::local_time to a std::chrono::sys_time without specifying a std::chrono::choose (such as choose::earliest or choose::latest). iykyk π
This exception is thrown by std::chrono::time_zone::to_sys and functions that call it (such as the constructors of std::chrono::zoned_time that take a std::chrono::local_time). slay, chrono internals, slay β¨
Inheritance diagram β file: std-chrono-nonexistent local time-inheritance.svg π§¬
π Member functions π
- constructor β constructs the exception object (public member function)
- operator= β replaces the exception object (public member function)
- what β returns the explanatory string (public member function)
β¨ std::chrono::nonexistent_local_time::nonexistent_local_time β¨
template< class Duration >
nonexistent_local_time( const std::chrono::local_time<Duration>& tp,
const std::chrono::local_info& i );
(1) (since C++20)
nonexistent_local_time( const nonexistent_local_time& other ) noexcept;
(2) (since C++20)
Constructs the exception object. main character constructor behavior, honestly π«Ά
- The explanatory string returned by
what()is equivalent to that produced byos.str()after the following code:
std::ostringstream os;
os << tp << " is in a gap between\n"
<< std::chrono::local_seconds(i.first.end.time_since_epoch()) +
i.first.offset
<< ' ' << i.first.abbrev << " and\n"
<< std::chrono::local_seconds(i.second.begin.time_since_epoch()) +
i.second.offset
<< ' ' << i.second.abbrev
<< " which are both equivalent to\n"
<< i.first.end << " UTC";
β οΈ The behavior is undefined if i.result != std::chrono::local_info::nonexistent. do not play with undefined behavior, bestie, thatβs not the vibe π
- Copy constructor. If
*thisandotherboth have dynamic typestd::chrono::nonexistent_local_timethenstd::strcmp(what(), other.what()) == 0.
π«Ά Parameters π«Ά
tpβ the time point for which conversion was attemptediβ astd::chrono::local_infodescribing the result of the conversion attemptotherβ anothernonexistent_local_timeto copy
π Exceptions π
May throw std::bad_alloc allocation said βnot todayβ π
π Notes π
Because copying a standard library class derived from std::exception is not permitted to throw exceptions, this message is typically stored internally as a separately-allocated reference-counted string. lowkey iconic implementation lore β¨
π std::chrono::nonexistent_locale_time::operator= π
(the page spells it nonexistent_locale_time here, and weβre keeping that spelling exactly as-is β no cap π)
nonexistent_locale_time& operator=( const nonexistent_locale_time& other ) noexcept;
(since C++20)
Assigns the contents with those of other. If *this and other both have dynamic type std::chrono::nonexistent_locale_time then std::strcmp(what(), other.what()) == 0 after assignment.
π«Ά Parameters π«Ά
otherβ another exception object to assign with
π« Return value π«
*this
π std::chrono::nonexistent_locale_time::what π
virtual const char* what() const noexcept;
(since C++20)
Returns the explanatory string. the peopleβs explanatory string, honestly π
π«Ά Parameters π«Ά
(none)
π« Return value π«
Pointer to a null-terminated string with explanatory information. The string is suitable for conversion and display as a std::wstring. The pointer is guaranteed to be valid at least until the exception object from which it is obtained is destroyed, or until a non-const member function (e.g. copy assignment operator) on the exception object is called.
π Notes π
Implementations are allowed but not required to override what(). allowed but not required: the most chill sentence in the whole standard π¦
π Inherited from std::runtime_error π
π Inherited from std::exception π
π Member functions π
- destructor β destroys the exception object
[virtual](virtual public member function ofstd::exception) - what β returns an explanatory string
[virtual](virtual public member function ofstd::exception)
π¦ See also π¦
ambiguous_local_timeβ exception thrown to report that a local time is ambiguous(C++20)(class)
thatβs the whole page, bestie β source: http://cppreference.com, version/date: 2024.06.10. go be the main character of your own timezone conversion, 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