| title | std::chrono::ambiguous_local_time | |||||||
|---|---|---|---|---|---|---|---|---|
| cppdoc |
|
import { CppHeader } from "@components/header"; import { Decl, DeclDoc } from "@components/decl-doc"; import { Desc, DescList } from "@components/desc-list"; import { ParamDoc, ParamDocList } from "@components/param-doc"; import Missing from "@components/Missing.astro"; import { Revision, RevisionBlock } from "@components/revision";
Defined in header .
```cpp class ambiguous_local_time; ```Defines a type of object to be thrown as exception to report that an attempt was made to convert an ambiguous std::chrono::local_time to a std::chrono::sys_time without specifying a std::chrono::choose (such as choose::earliest or choose::latest).
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).
The explanatory string returned by what() is equivalent to that produced by os.str() after the following code:
std::ostringstream os;
os << tp << " is ambiguous. It could be\n"
<< tp << ' ' << i.first.abbrev << " == "
<< tp - i.first.offset << " UTC or\n"
<< tp << ' ' << i.second.abbrev << " == "
<< tp - i.second.offset << " UTC";The behavior is undefined if i.result != std::chrono::local_info::ambiguous.
Copy constructor. If *this and other both have dynamic type std::chrono::ambiguous_local_time then std::strcmp(what(), other.what()) == 0.
May throw std::bad_alloc.
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.
Assigns the contents with those of other. If *this and other both have dynamic type std::chrono::ambiguous_local_time then std::strcmp(what(), other.what()) == 0 after assignment.
*this
Returns the explanatory string.
(none)
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.
Implementations are allowed but not required to override what().
Inherited from std::exception.