X-Spam-Check-By: sourceware.org
Message-ID: <444E7818.2040509@t-online.de>
Date: Tue, 25 Apr 2006 21:27:20 +0200
From: Christian Franke <Christian.Franke@t-online.de>
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@cygwin.com
Subject: Re: [Patch] patch -Z not working if timestamp contains seconds >=59.5
References: <1FYLWN-0KKWBs0@fwd33.aul.t-online.de> <20060425120713.GO28583@calimero.vinschen.de> <1FYOLi-0XgDOy0@fwd30.aul.t-online.de> <20060425164627.GA17484@calimero.vinschen.de>
In-Reply-To: <20060425164627.GA17484@calimero.vinschen.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-ID: EwqcyvZeweOB4i5K+dh29hWr3XeP5RJJVKWTIhO4l439pUg19yJN6+
X-TOI-MSGID: d65b5c62-9bd1-4165-ac53-d8c2fb4bf395
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Corinna Vinschen wrote:
> On Apr 25 16:17, Christian Franke wrote:
>   
>> Corinna Vinschen wrote:
>>     
>>> Can you tell me exactly where the problem
>>> happens which leads to this patch, please?
>>>       
>> partime.c:
>> ...
>> parse_pattern_letter (s, c, t)
>> ...
>> case 's': /* second [00-60 followed by optional fraction] */
>>   {
>>     int frac;
>>     s = parse_decimal (s, 2, 0, 60, 1, &t->tm.tm_sec, &frac);
>>     t->tm.tm_sec += frac;
>>   }
>>
>> parse_decimal("59.50001", ...) returns tm_sec = 59 and frac=1 which
>> results in tm_sec=60, but maketime({...; tm.tm_sec=60;...}, .) returns
>> -1 always.
>>     
>
> Yeah, these are exactly the lines which you patch.  When I asked for
> where exactly the problem happens, I was asking where maketime makes the
> mistake of not taking denormalized timestamps into account, where the
> condition is which let it return -1.
>   

IMO maketime() does not make any mistake.


> Don't get me wrong, I appreciate the patch, but since you provided a
> patch, I assumed you already debugged this problem, so you can point to
> the place where it happens.

According to the algorithm used and the comment in line 295:
   "ISO 8601 day-of-year and week numbers are not yet supported."
maketime() is (unlike mktime()) simply not designed to accept 
denormalized timestamps.

This is OK for the purpose maketime() used inside of patch, except for 
this one rare case described.


> Yes, I'm a lazy chicken and I'm just trying
> to avoid double work ;-)
>   

I took the (lazy) approach to fullfill maketime's interface contract and 
allow a < 0.5s round error ;-)

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/

