* [FFmpeg-devel] [PATCH] fate: Fix the sub-mcc tests on Windows in eastern time zones (PR #20214)
@ 2025-08-11 11:43 Martin Storsjö
0 siblings, 0 replies; only message in thread
From: Martin Storsjö @ 2025-08-11 11:43 UTC (permalink / raw)
To: ffmpeg-devel
PR #20214 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20214
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20214.patch
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.
To avoid the issue, pick a different, arbitrary reference time,
which should have a nonnegative time_t for all time zones.
From 02ec6b6f947a47143933d2cd817d123bcfa1aed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 11 Aug 2025 14:26:44 +0300
Subject: [PATCH] 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.
To avoid the issue, pick a different, arbitrary reference time,
which should have a nonnegative time_t for all time zones.
---
tests/fate/subtitles.mak | 12 ++++++------
tests/ref/fate/sub-mcc-remux | 2 +-
tests/ref/fate/sub-mcc-remux-eia608 | 2 +-
tests/ref/fate/sub-mcc-remux-eia608-bsf | 2 +-
tests/ref/fate/sub-mcc-remux-eia608-recode | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 56eefa3b88..8423e8311a 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -131,24 +131,24 @@ fate-sub-rcwt: CMP = oneline
fate-sub-rcwt: REF = d86f179094a5752d68aa97d82cf887b0
FATE_SUBTITLES-$(call ALLYES, AVDEVICE LAVFI_INDEV MOVIE_FILTER MPEGTS_DEMUXER MCC_MUXER EIA608_TO_SMPTE436M_BSF) += fate-sub-mcc
-fate-sub-mcc: CMD = md5 -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/scte20.ts[out0+subcc]" -map 0:s -c copy -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00" -bitexact -f mcc
+fate-sub-mcc: CMD = md5 -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/scte20.ts[out0+subcc]" -map 0:s -c copy -override_time_code_rate ntsc -creation_time "1970-01-02T00:00:00" -bitexact -f mcc
fate-sub-mcc: CMP = oneline
-fate-sub-mcc: REF = 752c60c3a74445a2a76e1a6465064763
+fate-sub-mcc: REF = 779ca7759324441febd6aa6039f29308
FATE_SUBTITLES-$(call DEMMUX, MCC, MCC, SMPTE436M_TO_EIA608_BSF EIA608_TO_SMPTE436M_BSF) += fate-sub-mcc-remux-eia608-bsf
-fate-sub-mcc-remux-eia608-bsf: CMD = fmtstdout mcc -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:s -c copy -bsf "eia608_to_smpte436m=cdp_frame_rate=60000/1001:initial_cdp_sequence_cntr=65535:line_number=11" -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00"
+fate-sub-mcc-remux-eia608-bsf: CMD = fmtstdout mcc -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:s -c copy -bsf "eia608_to_smpte436m=cdp_frame_rate=60000/1001:initial_cdp_sequence_cntr=65535:line_number=11" -override_time_code_rate ntsc -creation_time "1970-01-02T00:00:00"
fate-sub-mcc-remux-eia608-bsf: CMP = rawdiff
FATE_SUBTITLES-$(call DEMMUX, MCC, MCC, SMPTE436M_TO_EIA608_BSF EIA608_TO_SMPTE436M_BSF) += fate-sub-mcc-remux-eia608
-fate-sub-mcc-remux-eia608: CMD = fmtstdout mcc -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:s -c copy -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00"
+fate-sub-mcc-remux-eia608: CMD = fmtstdout mcc -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:s -c copy -override_time_code_rate ntsc -creation_time "1970-01-02T00:00:00"
fate-sub-mcc-remux-eia608: CMP = rawdiff
FATE_SUBTITLES-$(call DEMMUX, MCC, MCC, SMPTE436M_TO_EIA608_BSF EIA608_TO_SMPTE436M_BSF) += fate-sub-mcc-remux-eia608-recode
-fate-sub-mcc-remux-eia608-recode: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:d -c copy -bsf smpte436m_to_eia608 -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00"
+fate-sub-mcc-remux-eia608-recode: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:d -c copy -bsf smpte436m_to_eia608 -override_time_code_rate ntsc -creation_time "1970-01-02T00:00:00"
fate-sub-mcc-remux-eia608-recode: CMP = rawdiff
FATE_SUBTITLES-$(call DEMMUX, MCC, MCC) += fate-sub-mcc-remux
-fate-sub-mcc-remux: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:d -c copy -override_time_code_rate ntsc -creation_time "1970-01-01T00:00:00"
+fate-sub-mcc-remux: CMD = fmtstdout mcc -eia608_extract 0 -f mcc -i $(SRC_PATH)/tests/ref/fate/sub-mcc-remux -map 0:d -c copy -override_time_code_rate ntsc -creation_time "1970-01-02T00:00:00"
fate-sub-mcc-remux: CMP = rawdiff
FATE_SUBTITLES-$(call FRAMECRC, MPEGTS, DVBSUB, DVBSUB_ENCODER) += fate-sub-dvb
diff --git a/tests/ref/fate/sub-mcc-remux b/tests/ref/fate/sub-mcc-remux
index d9d2f32dc0..a58c040711 100644
--- a/tests/ref/fate/sub-mcc-remux
+++ b/tests/ref/fate/sub-mcc-remux
@@ -38,7 +38,7 @@ File Format=MacCaption_MCC V2.0
UUID=0087C4F6-A6B4-5469-8C8E-BBF44950401D
Creation Program=FFmpeg
-Creation Date=Thursday, January 1, 1970
+Creation Date=Friday, January 2, 1970
Creation Time=00:00:00
Time Code Rate=30DF
diff --git a/tests/ref/fate/sub-mcc-remux-eia608 b/tests/ref/fate/sub-mcc-remux-eia608
index 01e8c37b2c..f31562d524 100644
--- a/tests/ref/fate/sub-mcc-remux-eia608
+++ b/tests/ref/fate/sub-mcc-remux-eia608
@@ -38,7 +38,7 @@ File Format=MacCaption_MCC V2.0
UUID=0087C4F6-A6B4-5469-8C8E-BBF44950401D
Creation Program=FFmpeg
-Creation Date=Thursday, January 1, 1970
+Creation Date=Friday, January 2, 1970
Creation Time=00:00:00
Time Code Rate=30DF
diff --git a/tests/ref/fate/sub-mcc-remux-eia608-bsf b/tests/ref/fate/sub-mcc-remux-eia608-bsf
index 64e428f6f1..c0e125db5e 100644
--- a/tests/ref/fate/sub-mcc-remux-eia608-bsf
+++ b/tests/ref/fate/sub-mcc-remux-eia608-bsf
@@ -38,7 +38,7 @@ File Format=MacCaption_MCC V2.0
UUID=0087C4F6-A6B4-5469-8C8E-BBF44950401D
Creation Program=FFmpeg
-Creation Date=Thursday, January 1, 1970
+Creation Date=Friday, January 2, 1970
Creation Time=00:00:00
Time Code Rate=30DF
diff --git a/tests/ref/fate/sub-mcc-remux-eia608-recode b/tests/ref/fate/sub-mcc-remux-eia608-recode
index 01e8c37b2c..f31562d524 100644
--- a/tests/ref/fate/sub-mcc-remux-eia608-recode
+++ b/tests/ref/fate/sub-mcc-remux-eia608-recode
@@ -38,7 +38,7 @@ File Format=MacCaption_MCC V2.0
UUID=0087C4F6-A6B4-5469-8C8E-BBF44950401D
Creation Program=FFmpeg
-Creation Date=Thursday, January 1, 1970
+Creation Date=Friday, January 2, 1970
Creation Time=00:00:00
Time Code Rate=30DF
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-11 11:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-11 11:43 [FFmpeg-devel] [PATCH] fate: Fix the sub-mcc tests on Windows in eastern time zones (PR #20214) Martin Storsjö
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git