<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85556>85556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`src/time/time_utils.h` unconditionally uses `EOVERFLOW`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
Including `time.h` entrypoints such as `asctime`, `gmtime` or `mktime` results in a compile error:
```
In file included from /usr/local/google/home/phosek/llvm/llvm-project/libc/src/time/asctime.cpp:11:
/usr/local/google/home/phosek/llvm/llvm-project/libc/src/time/time_utils.h:94:16: error: use of undeclared identifier 'EOVERFLOW'
94 | libc_errno = EOVERFLOW;
| ^
1 error generated.
```
This is because `src/time/time_utils.h` [unconditionally uses `EOVERFLOW`](https://github.com/llvm/llvm-project/blob/89b7b3b9952210fbd9bd0db95385bfed69ffc7a3/libc/src/time/time_utils.h#L94) which is only defined in POSIX and not in C standard, but we're trying to avoid including POSIX in baremetal environments. More generally, I don't think that functions defined by the C standard should have unconditional dependencies on POSIX.
CC @michaelrj-google
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VF2L4zYU_TXKy2WDLNmO_eCHTGYMA1umtKXt26KP60g7smQkeZb8-yInu-lCl04fGoLFFYerc-45kkjJnj3iQJoH0jzuxJpNiMOCOZqQ8HUng74Mz165VVt_BtLSbGfcG9JSQJ_jZQnW5wRpVQZEKgCRVMGQlhJ2Khvn-VZDiKWeX7_WEdPqcgLrQYAK82IdAsYYIuFHQh8JPZY21_9WPnuYCshulFDDFMMMhI1rioSNLijhCBvPIZwdEjaaMJdl2dQUgHubb8uHJYbPqHIprVSEjSmW70aOjTcZe7UshB-r6s7ofzisLJ_WbF3aG8KPfV2ObAk_fpsGrAkhTLB6jcqJiBqsRp_tZDECYYenl9-ffhk_vvxB2AGuTAGgr4EcTgBQTv2EMfoAhD_CHc0f7miAG_q7H2mebpDqSgfO6DGKjHr_jyb9ZmwCm0CiEoU2aemP1bYUSPOwehW8ttkGL5y7FLVbmO48W0qaR8I6k_OSihlsLLO32axyr8L8w3lLFyRhY9fLg-Sy7xvGKjpJ3UtNtewb3jVyQt3206QOgr_HIcY_9jVhPXwxVpkiNXh3AY2T9cUYDz-__Pr8JwivwYdcNk6QsvBaRF1uhVwzfEHCDhEhx0u5WjmAeAtW36Jdtq5NrAcpIs6YhQP0bzYGP6PPaQ8_hYg3M5y7lMbPoIMn7JAhG-tfIRuRYVq9KpNN3xjKC2SDfyMFyYTVaTDiDeE7M0Djgl6jVxaLziurr8Zv39MJSE1nq4xAFz9_uF4I2OmB6573YodDdahoy2nTNjszdD2rRd3Rnrddx7EWVNRMcMkUm1RH5c4OjLKa8qplnPas2fcHPtWV1kIg5xVWpKY4C-v2xet9iOedTWnFoWuapt05IdGl7U1j7GomK69bHLZoyPWcSE2dTTndG2SbHQ7_FtX35HS3Rjf855huAlIJatHwVwAAAP__PJrGjQ">