<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113654>113654</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
chrono::time_zone::to_sys() on 'nonexistent time' deviates
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrisse74
</td>
</tr>
</table>
<pre>
When calling the (experimental-library feature) std::chrono::time_zone::to_sys() with a 'nonexistent time' (daylight saving) the hour is corrected, but the minute part remains.
According to https://en.cppreference.com/w/cpp/chrono/time_zone/to_sys the correct behaviour would be: "If tp represents a nonexistent time between two UTC time_points, those two time_points will be the same, and that time_point will be returned."
### Example
```
int main()
{
using namespace std::literals;
const std::chrono::time_zone* specificTimeZone = std::chrono::get_tzdb().locate_zone("Europe/Vienna");
{
const std::chrono::local_seconds inpTime{ std::chrono::local_days{ 2024y / std::chrono::March / 31d } + 2h + 0min };
const std::chrono::sys_seconds experimentalSystemTimestamp = specificTimeZone->to_sys(inpTime, std::chrono::choose::earliest);
std::cout << "UTC Timestamp: " << experimentalSystemTimestamp << std::endl;
}
{
const std::chrono::local_seconds inpTime{ std::chrono::local_days{ 2024y / std::chrono::March / 31d } + 2h + 30min };
const std::chrono::sys_seconds experimentalSystemTimestamp = specificTimeZone->to_sys(inpTime, std::chrono::choose::earliest);
std::cout << "UTC Timestamp: " << experimentalSystemTimestamp << std::endl;
}
{
const std::chrono::local_seconds inpTime{ std::chrono::local_days{ 2024y / std::chrono::March / 31d } + 3h + 0min };
const std::chrono::sys_seconds experimentalSystemTimestamp = specificTimeZone->to_sys(inpTime, std::chrono::choose::earliest);
std::cout << "UTC Timestamp: " << experimentalSystemTimestamp << std::endl;
}
```
### Output
```
UTC Timestamp: 2024-03-31 01:00:00
UTC Timestamp: 2024-03-31 01:30:00
UTC Timestamp: 2024-03-31 01:00:00
```
### Expected output
I would expect all the local timestamps between 31.03.2024 02:00 and 3:00 being converted to the same UTC timestamp (2024-03-31 01:00:00).
### Environment
* clang version 19.1.2
* compiled using -fexperimental-library
* RHEL 9.4
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVltv4zYT_TX0y8CCRMq3Bz04Toxvga8o0G5boC8BRY0tFhQpkCM73l9fUFJ8SbLJFn3oFqhh6DaHnHNmSPDIEPTeIhZsdsdm9xPZUe18oWqvQ8BFPilddSp-q9GCksZouweqERhf4lOLXjdoSZqp0aWX_gQ7lNR5ZHwFgSom1kysVe2ddcMz6QYfvziL46t7DKfA-DIOOGqqQQLjC-ssPulAaAniCMYXMWMlT0bva4IgD9ru45jIpXadBx1AOe9REVaMb6DsqA822naE0EpP4LGR2oaEpfcsXQ_XtVLOV70sBzVRGyIzvmV8izZRbetxhx6twkS5hvHtkfGtatt4HXTx7UUU3w6K-tQjHyixlgcdSR5dZyooo3hgnH_aAbXgsfUY0FIACS-VQ4l0RLRARwe_fN70Hx9bpy2FKJNqF7APXgXgqI2BEnsWQcb6bUDaCqiWdAU84zxS5y1WCeP8ujiMi-EPD0-yaQ2On-fp-O9f40yxsEMbR8jibngAAOhCrK-VDYZWKrysDKMJvTSBiSu0cjbQR6uHryG0qPROq8-6wd-dRWDi_u1he6RH-lKVA8HEOCXpeZ4l4_yh866NzftVo7UyFoGvbjhd5LzDLs5rHgMqZ6sA2raRGVvcvYeu5ClECE95fgLGt2-Df5Be1X1YZBWwxT0wfge87m9po238dsP4g0qGUzgzvd7IP58CYROJB5JNO9T0RaGnTDycN-6zTL55O5GqnQvjbkfpjcZAN9W9jHIdARMbJjZxc8TFfuYxbpjn8PuMe8h5WrSVedHL--s1ftvejyv3T3VZ_LvbPP6-r25_T20W_23mv9Xe2zPp5fn1Y0dtR29CX3GL7ZumYioySDMm1mk6XL4NLf4S-mbuDzQ8PLW9vQF3JebTaCqwD4I0pj_1-wXZH_V96nD2ESJLUpFEGpDyPnfvDMTwWGI8qZWzB_QxE7mzhzi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