Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::chrono::time_zone::to_sys

      From cppreference.com
      <cpp‎ |chrono‎ |time zone
       
       
      Date and time library
       
       
      template<class Duration>

      auto to_sys(conststd::chrono::local_time<Duration>& tp)const

         ->std::chrono::sys_time<std::common_type_t<Duration,std::chrono::seconds>>;
      (1)(since C++20)
      template<class Duration>

      auto to_sys(conststd::chrono::local_time<Duration>& tp,std::chrono::choose z)const

         ->std::chrono::sys_time<std::common_type_t<Duration,std::chrono::seconds>>;
      (2)(since C++20)

      Converts thelocal_timetp in this time zone to the correspondingsys_time.

      1) Throws an exception if the conversion is ambiguous or iftp represents a nonexistent time.
      2) Resolves ambiguity according to the value ofz:
      • Ifz== std::chrono::choose::earliest, returns the earliersys_time.
      • Ifz== std::chrono::choose::latest, returns the latersys_time.
      Iftp represents a nonexistent time between two UTCtime_points, those twotime_points will be the same, and thattime_point will be returned.

      Contents

      [edit]Return value

      The UTC equivalent oftp according to the rules of this time zone.

      [edit]Exceptions

      1) Throws:

      [edit]Notes

      The precision of the result is at leaststd::chrono::seconds, and will be finer if the argument has finer precision.

      Ambiguous and nonexistent local times can occur as a result of time zone transitions (such as daylight saving time). For example,"2016-03-13 02:30:00" does not exist in the"America/New_York" time zone, while"2016-11-06 01:30:00" in that time zone can correspond to two UTC time points:2016-11-0605:30:00 UTC and2016-11-0606:30:00 UTC.

      [edit]Example

      This section is incomplete
      Reason: no example
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/time_zone/to_sys&oldid=169726"

      [8]ページ先頭

      ©2009-2025 Movatter.jp