delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/26/04:09:23

X-Spam-Check-By: sourceware.org
Date: Wed, 26 Apr 2006 10:08:58 +0200
From: Peter Ekberg <peda AT lysator DOT liu DOT se>
To: cygwin AT cygwin DOT com
Subject: Re: [Patch] patch -Z not working if timestamp contains seconds >=59.5
Message-ID: <20060426080858.GA14738@sellafield.lysator.liu.se>
References: <054c01c668a4$554924e0$a501a8c0 AT CAM DOT ARTIMI DOT COM> <444E95C0 DOT 9080708 AT t-online DOT de>
Mime-Version: 1.0
In-Reply-To: <444E95C0.9080708@t-online.de>
User-Agent: Mutt/1.5.11
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

On Tue, Apr 25, 2006 at 11:33:52PM +0200, Christian Franke wrote:
> 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.

If you thought about all that, maybe you also thought about leap seconds?
Isn't it valid to have 60 in the seconds field when a leap second is added?

Cheers,
Peter

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