You might want to have a look at __mktime_internal ().
I discovered some time ago that mktime() did not return correct time_t values in some cases.
For examples
America/New_York, 1945-08-14 19:00:00, where the only difference is the Abbr (tm_zone), from EWT to EPT
Africa/Johannesburg, 1944-03-19 01:00:00, where the Abbr (tm_zone) is the same, SAST to SAST
__mktime_internal () was missing points near these transitions (and others) and so returning incorrect results. This was causing much confusion in my testing.
The problem was that __mktime_internal
() was comparing only isdst where it also needed to compare Abbr, as explained more in comments in the attached modified code.
Attached is the __mktime_internal () code with my suggested modifications extracted from
glibc-2.38\time\mktime.c
as downloaded from
https://mirrors.ibiblio.org/gnu/libc/glibc-2.38.tar.xz
See the two code blocks commented // Modified by Brooks Harris
Since making these changes I have not seen mktime() make any errors
at many thousands of test points where localtime() was populating
struct tm.
I hope this might be helpful.
-Brooks