Namespaces
Variants

std::chrono::time_zone:: to_sys

From cppreference.net
template < class Duration >

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

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

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

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

このタイムゾーン内の local_time tp を対応する sys_time に変換します。

1) 変換が曖昧である場合、または tp が存在しない時間を表す場合、例外をスローします。
2) 曖昧性を z の値に従って解決する:
  • z == std :: chrono :: choose :: earliest の場合、より早い sys_time を返す。
  • z == std :: chrono :: choose :: latest の場合、より遅い sys_time を返す。
もし tp が2つのUTC time_point 間の存在しない時間を表す場合、それら2つの time_point は同一となり、その time_point が返されます。

目次

戻り値

このタイムゾーンの規則に従った tp のUTC相当値。

例外

1) 例外:

注記

結果の精度は少なくとも std::chrono::seconds であり、引数がより細かい精度を持つ場合はさらに細かくなります。

タイムゾーンの切り替え(夏時間など)により、曖昧なローカル時間や存在しないローカル時間が発生することがあります。例えば、 "2016-03-13 02:30:00" "America/New_York" タイムゾーンには存在せず、一方で "2016-11-06 01:30:00" はそのタイムゾーンにおいて2つのUTC時間点に対応する可能性があります: 2016 - 11 - 06 05 : 30 : 00 UTC 2016 - 11 - 06 06 : 30 : 00 UTC