Created on 2019-06-30.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4820.
Modify [time.zone.zonedtime.overview] as indicated:
[…] template<class Duration, class TimeZonePtr, class TimeZonePtr2> zoned_time(TimeZonePtr, zoned_time<Duration, TimeZonePtr2>, choose = choose::earliest) -> zoned_time<common_type_t<Duration, seconds>, TimeZonePtr>; […]
[ 2019-07 Issue Prioritization ]
Status to Tentatively Ready after five positive votes on the reflector.
Currently, the time_zone
is always storing the time with
the precision not coarser that seconds
, as consequence any
instance with the duration with coarser precision with seconds
,
is de-facto equivalent to one instantiated to the duration of seconds.
This is caused by the fact, that time zone offset can be defined up to
seconds precision. To illustrate both of following specialization has
the same behavior (keep seconds
):
zoned_time<minutes> zt(current_zone(), floor<minutes>(system_clock::now()); zoned_time<hours> zt(current_zone(), floor<hours>(system_clock::now()); zoned_time<seconds> zt(current_zone(), floor<seconds>(system_clock::now());
To avoid unnecessary code bloat caused by above, most deduction guides
are instantiating zoned_time
with at least seconds
precision (i.e. zoned_time<seconds>
will be deduced
for all of above):
template<class TimeZonePtr, class Duration> zoned_time(TimeZonePtr, zoned_time<Duration>, choose = choose::earliest) -> zoned_time<common_type_t<Duration, seconds>, TimeZonePtr>;
However there is single exception:
template<class Duration, class TimeZonePtr, class TimeZonePtr2> zoned_time(TimeZonePtr, zoned_time<Duration, TimeZonePtr2>, choose = choose::earliest) -> zoned_time<Duration, TimeZonePtr>;
This deduction guide should be updated to preserve the consistency of design.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2019-11-19 14:48:30 | admin | set | status: voting -> wp |
2019-10-07 02:48:00 | admin | set | status: ready -> voting |
2019-07-23 15:26:26 | admin | set | messages: + msg10513 |
2019-07-23 15:26:26 | admin | set | status: new -> ready |
2019-06-30 19:21:26 | admin | set | messages: + msg10477 |
2019-06-30 00:00:00 | admin | create |