So how hard could it be. As input we have something like Fri, 17 Jan 2025 06:07:07 in UTC, and we’d like to turn this into 1737094027, the notional (but not actual) number of seconds that have passed since 1970-01-01 00:00:00 UTC.
Trying to figure this out led me to discover many ‘surprise features’ and otherwise unexpected behaviour of POSIX time handling functions as implemented in various C libraries & the languages that build on them. There are many good things in the world of C and UNIX, but time handling is not one of them.
The tl;dr: as long as you never call setlocale(), you can use strptime() to parse a UTC time string. Do not use %z or %Z. Pass the struct tm calculated by strptime() to the pre-standard function timegm() (mkgmtime() on Windows) to get the correct UNIX epoch timestamp for your UTC time string. Do read on for solutions for if you do use locales. C++ has better support, which could also help you from C.
Time is difficult enough by itself, even if we ignore leap seconds and general relativity. When we add human behaviour and politics, it all becomes exceptionally challenging. Timestamps as used by human beings range from impossible to imprecise.