On 2024-08-22 16:49, Alejandro Colomar wrote:
t = mktime(tp); if (t == -1 && errno == EOVERFLOW) return -1;
This isn't right, for the same reason similar code wasn't right earlier. A successful call to mktime can return -1 and set errno to whatever value it likes.
This is just the first problem I found with the code (and I found it quickly because I remembered the earlier problem). I would expect there to be others.
How about if we omit the sample code and make the minimal changes I suggested earlier?