]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Do not loop endlessly if converting into dv with timestamps Jan 1st not
authorcehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 21 May 2008 07:05:08 +0000 (07:05 +0000)
committercehoyos <cehoyos@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 21 May 2008 07:05:08 +0000 (07:05 +0000)
immediately following a lapyear.

Patch by babupillai.
Fixes issue 443.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13207 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/cutils.c

index 32887c4bc401a119cf8e2efab2941f5adba31911..42ef5996d996e57b59e147c3e0cc2b3d676d1e79 100644 (file)
@@ -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];