Namespaces
Variants
Actions

std::chrono::zoned_time

From cppreference.com
< cpp‎ | chrono
 
 
 
 
Defined in header <chrono>
template<

    class Duration,
    class TimeZonePtr = const std::chrono::time_zone*

> class zoned_time;
(since C++20)
using zoned_seconds = std::chrono::zoned_time<std::chrono::seconds>;
(since C++20)

The class zoned_time represents a logical pairing of a time zone and a std::chrono::time_point whose resolution is Duration.

An invariant of zoned_time is that it always refers to a valid time zone and represents an existing and unambiguous time point in that time zone. Consistent with this invariant, zoned_time has no move constructor or move assignment operator; attempts to move a zoned_time will perform a copy.

The program is ill-formed if Duration is not a specialization of std::chrono::duration.

The template parameter TimeZonePtr allows users to supply their own time zone pointer types and further customize the behavior of zoned_time via std::chrono::zoned_traits. Custom time zone types need not support all the operations supported by std::chrono::time_zone, only those used by the functions actually called on the zoned_time.

TimeZonePtr must be MoveConstructible. Move-only TimeZonePtrs are allowed but difficult to use, as the zoned_time will be immovable and it is not possible to access the stored TimeZonePtr.

Contents

[edit] Member types

Member type Definition
duration std::common_type_t<Duration, std::chrono::seconds>

[edit] Member functions

constructs a zoned_time
(public member function) [edit]
assigns value to a zoned_time
(public member function) [edit]
obtains a copy of the time zone pointer
(public member function) [edit]
obtains the stored time point as a local_time
(public member function) [edit]
obtains the stored time point as a sys_time
(public member function) [edit]
obtain information about the time zone at the stored time point
(public member function) [edit]

[edit] Non-member functions

compares two zoned_time values
(function template) [edit]
outputs a zoned_time into a stream
(function template) [edit]

[edit] Helper classes

formatting support for zoned_time
(class template specialization) [edit]
hash support for std::chrono::zoned_time
(class template specialization)

[edit] Helper specializations

template< class Duration >

constexpr bool enable_nonlocking_formatter_optimization

  <chrono::zoned_time<Duration, const chrono::time_zone*>> = true;
(since C++23)

This specialization of std::enable_nonlocking_formatter_optimization enables efficient implementation of std::print and std::println for printing a chrono::zoned_time object.

[edit]