delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/25/10:17:26

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <20060425120713.GO28583@calimero.vinschen.de>
References: <1FYLWN-0KKWBs0 AT fwd33 DOT aul DOT t-online DOT de> <20060425120713 DOT GO28583 AT calimero DOT vinschen DOT de>
Date: Tue, 25 Apr 2006 16:17:06 +0200
To: cygwin AT cygwin DOT com
X-UMS: email
X-Mailer: TOI Kommunikationscenter V7-0-3
Subject: Re: [Patch] patch -Z not working if timestamp contains seconds >=59.5
From: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
Message-ID: <1FYOLi-0XgDOy0@fwd30.aul.t-online.de>
X-ID: X7Ua7QZlwe-5wQWq2vbONA3wS+6CiBX0E368BRJqgw+dZ0N2YSjsQ4 AT t-dialin DOT net
X-TOI-MSGID: f63a3fc8-34e9-49d9-b6f9-731f6404e041
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Corinna Vinschen wrote:

> This doesn't look like a Cygwin specific problem.

Agree, but the RCSID "$Id: partime.c,v ... corinna ...$" encourages me
to report the problem to this list first ;-)


> I don't see this in
> patch-2.5.9, nor in any patched version from Fedora Core or SuSE
Linux.
> Did you send this upstream?

No.


> 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.

Please try:

$ gcc -DTEST -I. -o str2time maketime.c partime.c

$ echo 2006-04-25 12:00:58.500000 | ./str2time
`2006-04-25 12:00:58.500000' -> Tue Apr 25 12:00:58 2006

$ echo 2006-04-25 12:00:58.500001 | ./str2time
`2006-04-25 12:00:58.500001' -> Tue Apr 25 12:00:59 2006

$ echo 2006-04-25 12:00:59.500000 | ./str2time
`2006-04-25 12:00:59.500000' -> Tue Apr 25 12:00:59 2006

but:

$ echo 2006-04-25 12:00:59.500001 | ./str2time
`2006-04-25 12:00:59.500001' -> Thu Jan  1 00:59:59 1970

Same result for patch-2.5.9.

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019