ffmpeg/tests
Martin Storsjö 26da3d0069 fate: Fix the sub-mcc tests on Windows in eastern time zones
Previously, these tests failed when running on Windows, if the
system is configured with a time zone east of Greenwich, i.e.
with a positive GMT offset.

The muxer converts the creation_date given by the user using
av_parse_time to unix time, as a time_t. The creation_date is
interpreted as a local time, i.e. according to the current time
zone. (This time_t value is then converted back to a broken out
local time form with localtime_r.)

The given reference date/time, "1970-01-01T00:00:00", is the
origin point for unix time, corresponding to time_t zero. However
when interpreted as local time, this doesn't map to exactly zero.
Time zones east of Greenwich reached this time a number of hours
before the point of zero time_t - so the corresponding time_t
value essentially is minus the GMT offset, in seconds.

Windows mktime returns an error, returning (time_t)-1, when given
such a "struct tm", while e.g. glibc mktime happily returns a
negative time_t. av_parse_time doesn't check the return value of
mktime for potential errors.

This is observable with the following test snippet:

    struct tm tm = { 0 };
    tm.tm_year = 70;
    tm.tm_isdst = -1;
    tm.tm_mday = 1;
    tm.tm_hour = 0;
    time_t t = mktime(&tm);
    printf("%d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
    printf("t %d\n", (int)t);

By varying the value of tm_hour and the system time zone, one
can observe that Windows mktime returns -1 for all time_t values
that would have been negative.

This range limit is also documented by Microsoft in detail at
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64.

To avoid the issue, pick a different, arbitrary reference time,
which should have a nonnegative time_t for all time zones.

(cherry picked from commit 13139d6d83)
Signed-off-by: Martin Storsjö <martin@martin.st>
2025-08-12 13:45:57 +03:00
..
api tests/api/api-dump-stream-meta-test: Fix leaks 2025-05-05 17:03:39 +02:00
checkasm all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
fate fate: Fix the sub-mcc tests on Windows in eastern time zones 2025-08-12 13:45:57 +03:00
filtergraphs tests/fate: add fate test for excessive frame buffering when using filters 2025-07-14 22:05:11 +02:00
maps
ref fate: Fix the sub-mcc tests on Windows in eastern time zones 2025-08-12 13:45:57 +03:00
streamgroups avformat/iamf: use the correct layouts for Sound Systems B and C 2025-01-03 10:27:13 -03:00
.gitignore
audiogen.c tests/audiogen: Fix total RIFF chunk size 2024-03-28 11:54:41 +01:00
audiomatch.c
base64.c
copycooker.sh
extended.ffconcat all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
fate-run.sh fate/filter-video: add ffprobe test for dual output select filter 2025-07-03 21:41:54 +02:00
fate-valgrind.supp
fate.sh fate: allow https for git URLs 2024-04-27 23:24:58 +02:00
Makefile fate/all: add missing crc/framecrc/md5/framemd5/pipe dependencies 2025-07-05 21:10:49 +02:00
md5.sh
refcmp-metadata.awk
reference.pnm
rotozoom.c
simple1.ffconcat all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
simple2.ffconcat all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
test.ffmeta
tiny_psnr.c
tiny_ssim.c
utils.c
videogen.c