strptime() only sets what it parses, this test will fail if
localtime_r() and strptime() disagree on the local timezone, so
use localtime_r() to initialize tm with current tz to ensure they
will.
/* try to parse result */
struct tm tm;
i_zero(&tm);
+ /* get localtime to ensure we are in same timezone */
+ time_t t = time(NULL);
+ if (localtime_r(&t, &tm) == NULL)
+ i_panic("localtime_r() failed: %m");
if (strptime(datetime, "%Y%m%dT%H%M%S", &tm) == NULL) {
test_failed(t_strdup_printf("strptime() failed: %m"));
} else {