The test program works as-is only if the timezone isn't set (to something different than UTC). However, using localtime() instead of gmtime() makes it at least consistent in that the original time (given to mktime()) is identical to the time retrieved.
failures += !(rawtime == 1608805850);
- p_timeinfo = gmtime(&rawtime);
+ p_timeinfo = localtime(&rawtime);
failures += !(p_timeinfo->tm_year == timeinfo.tm_year);
failures += !(p_timeinfo->tm_mon == timeinfo.tm_mon);