From: Glenn Randers-Pehrson Date: Tue, 12 Sep 2017 00:39:11 +0000 (-0400) Subject: Revise time calculations again. X-Git-Tag: 7.0.7-2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b933a57b4d8f8d7a6052f4fc0171faed309950a;p=imagemagick Revise time calculations again. --- diff --git a/coders/png.c b/coders/png.c index 501fc58a2..55ca31f38 100644 --- a/coders/png.c +++ b/coders/png.c @@ -8181,29 +8181,29 @@ static void write_tIME_chunk(Image *image,png_struct *ping,png_info *info, if (addhours < 0) { addhours+=24; - hour+=addhours; day--; - if (day == 0) + } + hour+=addhours; + minute+=addminutes; + if (day == 0) + { + month--; + day=31; + if(month == 2) + day=28; + else { - month--; - if(month == 2) - day=28; + if(month == 4 || month == 6 || month == 9 || month == 11) + day=30; else - { - if(month == 4 || month == 6 || month == 9 || month == 11) - day=30; - else - day=31; - } - } - if (month == 0) - { - month++; - year--; + day=31; } } - hour+=addhours; - minute+=addminutes; + if (month == 0) + { + month++; + year--; + } if (minute > 60) { hour++;