From: Glenn Randers-Pehrson Date: Fri, 4 Aug 2017 02:25:02 +0000 (-0400) Subject: handle end-of-day wraparound in tIME chunk calculation. To do: handle short months. X-Git-Tag: 7.0.6-6~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6bc98630b7b6675ba3cbe74db8e9f2ed1f5e0a11;p=imagemagick handle end-of-day wraparound in tIME chunk calculation. To do: handle short months. --- diff --git a/coders/png.c b/coders/png.c index ece03b191..0a5a60455 100644 --- a/coders/png.c +++ b/coders/png.c @@ -8189,6 +8189,22 @@ static void write_tIME_chunk(Image *image,png_struct *ping,png_info *info, if (ptime.minute > 60) { ptime.hour++; + if (ptime.hour > 24) + { + ptime.hour = 0; + ptime.day ++; + /* To do: fix this for short months */ + if (ptime.day > 31) + { + ptime.day = 1; + ptime.month++; + if (ptime.month > 12) + { + ptime.month=1; + ptime.year++; + } + } + } ptime.minute=+60; } ptime.second=(png_byte) second;