Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::chrono::nonexistent_local_time

      From cppreference.com
      <cpp‎ |chrono
       
       
      Date and time library
       
      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 nonexistentstd::chrono::local_time to astd::chrono::sys_time without specifying astd::chrono::choose (such aschoose::earliest orchoose::latest).

      This exception is thrown bystd::chrono::time_zone::to_sys and functions that call it (such as the constructors ofstd::chrono::zoned_time that take astd::chrono::local_time).

      std-chrono-nonexistent local time-inheritance.svg

      Contents

      [edit]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(conststd::chrono::local_time<Duration>& tp,

                             conststd::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.

      1) The explanatory string returned bywhat() 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 ifi.result!= std::chrono::local_info::nonexistent.
      2) Copy constructor. If*this andother both have dynamic typestd::chrono::nonexistent_local_time thenstd::strcmp(what(), other.what())==0.

      Parameters

      tp - the time point for which conversion was attempted
      i - astd::chrono::local_info describing the result of the conversion attempt
      other - anothernonexistent_local_time to copy

      Exceptions

      May throwstd::bad_alloc

      Notes

      Because copying a standard library class derived fromstd::exception is not permitted to throw exceptions, this message is typically stored internally as a separately-allocated reference-counted string.

      std::chrono::nonexistent_locale_time::operator=

      nonexistent_locale_time& operator=(const nonexistent_locale_time& other)noexcept;
      (since C++20)

      Assigns the contents with those ofother. If*this andother both have dynamic typestd::chrono::nonexistent_locale_time thenstd::strcmp(what(), other.what())==0 after assignment.

      Parameters

      other - another exception object to assign with

      Return value

      *this

      std::chrono::nonexistent_locale_time::what

      virtualconstchar* what()constnoexcept;
      (since C++20)

      Returns the explanatory string.

      Return value

      Pointer to an implementation-defined null-terminated string with explanatory information. The string is suitable for conversion and display as astd::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 overridewhat().

      Inherited fromstd::runtime_error


      Inherited fromstd::exception

      Member functions

      [virtual]
      destroys the exception object
      (virtual public member function ofstd::exception)[edit]
      [virtual]
      returns an explanatory string
      (virtual public member function ofstd::exception)[edit]

      [edit]See also

      exception thrown to report that a local time is ambiguous
      (class)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/nonexistent_local_time&oldid=160401"

      [8]ページ先頭

      ©2009-2025 Movatter.jp