diff options
author | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2008-05-21 07:05:08 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2008-05-21 07:05:08 +0000 |
commit | 392f227393f479ab9a461aba68ae4c6b6da685a4 (patch) | |
tree | 17d78bc8d6f153d0215b4f54c7b7668ea09eac28 | |
parent | 4860abb116674c7be31e825db05cdcfd30f3aff2 (diff) | |
download | ffmpeg-392f227393f479ab9a461aba68ae4c6b6da685a4.tar.gz |
Do not loop endlessly if converting into dv with timestamps Jan 1st not
immediately following a lapyear.
Patch by babupillai.
Fixes issue 443.
Originally committed as revision 13207 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/cutils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/cutils.c b/libavformat/cutils.c index 32887c4bc4..42ef5996d9 100644 --- a/libavformat/cutils.c +++ b/libavformat/cutils.c @@ -77,11 +77,12 @@ struct tm *brktimegm(time_t secs, struct tm *tm) /* oh well, may be someone some day will invent a formula for this stuff */ y = 1970; /* start "guessing" */ - while (days >= (ISLEAP(y)?366:365)) { + while (days > 365) { ny = (y + days/366); days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); y = ny; } + if (days==365 && !ISLEAP(y)) { days=0; y++; } md[1] = ISLEAP(y)?29:28; for (m=0; days >= md[m]; m++) days -= md[m]; |