Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::chrono...s_local_time(3) C++ Standard Libarystd::chrono...s_local_time(3)

NAME
       std::chrono::ambiguous_local_time - std::chrono::ambiguous_local_time

Synopsis
	  Defined in header <chrono>
	  class	ambiguous_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   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 func-
       tions that call
	  it (such as the constructors of std::chrono::zoned_time that takes a
	  std::chrono::local_time).

	  std-chrono-ambiguous local time-inheritance.svg

					  Inheritance diagram

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::ambiguous_local_time::ambiguous_local_time

	  template< class Duration >

	  ambiguous_local_time(	 const	std::chrono::local_time<Duration>& tp,
       (1) (since C++20)

	  const	std::chrono::local_info& i );
	  ambiguous_local_time(	  const	   ambiguous_local_time&    other    )
       (2) (since C++20)
	  noexcept;

	  Constructs the exception object.

	  1)  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::lo-
       cal_info::ambiguous.
	  2) Copy constructor. If *this	and other both have dynamic type
	  std::chrono::ambiguous_local_time	 then	   std::strcmp(what(),
       other.what()) ==	0.

Parameters
	  tp	- the time point for which conversion was attempted
	  i	- a std::chrono::local_info describing the result of the  con-
       version attempt
	  other	- another ambiguous_local_time to copy

Exceptions
	  May throw std::bad_alloc

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

       std::chrono::ambiguous_locale_time::operator=

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

	  Assigns the contents with those of other. If *this  and  other  both
       have dynamic type
	  std::chrono::ambiguous_locale_time	  then	   std::strcmp(what(),
       other.what()) ==	0 after
	  assignment.

Parameters
	  other	- another exception object to assign with

Return value
	  *this

       std::chrono::ambiguous_locale_time::what

	  virtual const	char* what() const noexcept;  (since C++20)

	  Returns the explanatory string.

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  ob-
       tained 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().

       Inherited from std::runtime_error

       Inherited from std::exception

Member functions
	  destructor   destroys	the exception object
	  [virtual]    (virtual	public member function of std::exception)
	  what	       returns an explanatory string
	  [virtual]    (virtual	public member function of std::exception)

http://cppreference.com		  2022.07.31	 std::chrono...s_local_time(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::chrono::ambiguous_local_time&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help