X-Spam-Check-By: sourceware.org Message-ID: <444E95C0.9080708@t-online.de> Date: Tue, 25 Apr 2006 23:33:52 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [Patch] patch -Z not working if timestamp contains seconds >=59.5 References: <054c01c668a4$554924e0$a501a8c0 AT CAM DOT ARTIMI DOT COM> In-Reply-To: <054c01c668a4$554924e0$a501a8c0@CAM.ARTIMI.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: EkKgqZZGQeTJV8qBBVjtc+iX2amujYdrvGs4zUQjvaNMfnUq678DwS X-TOI-MSGID: 968c27a0-26b8-434c-a76a-d02b14bd8f80 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Dave Korn wrote: > ... > diff -rup patch-2.5.8-8.orig/partime.c patch-2.5.8-8/partime.c > --- patch-2.5.8-8.orig/partime.c 2002-12-15 21:37:32.001000000 +0100 > +++ patch-2.5.8-8/partime.c 2006-04-25 12:14:59.797168500 +0200 > @@ -753,6 +753,8 @@ parse_pattern_letter (s, c, t) > int frac; > s = parse_decimal (s, 2, 0, 60, 1, &t->tm.tm_sec, &frac); > t->tm.tm_sec += frac; > + if (t->tm.tm_sec > 59) > + t->tm.tm_sec = 59; > } > break; > > > I'm not sure if rounding errors can be a good idea when makefiles might be > involved. Why isn't your code propagating the carry, i.e. setting tm_sec to > zero and incrmenting the minutes? ... and then propagate the carry to hours, to days, ..., finally handle leap years and invalid local times during DST change? The patch simply changes rounding mode for a small interval from round-to-nearest to round-down. This IMO does not add any new monotonicity issues. As an alternative, round-down (ignore "frac") could be used always. Then timestamps would be consistent with tar, at least on Cygwin. In the current versions of patch and tar, a file with NTFS timestamp of e.g. "12:00:00.7" is transfered as "12:00:01" by patch, but "12:00:00" by tar. So I would suggest a version 0.0002 of my patch^2 as: int frac; s = parse_decimal (s, 2, 0, 60, 1, &t->tm.tm_sec, &frac); - t->tm.tm_sec += frac; } Christian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/