This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Patch] patch -Z not working if timestamp contains seconds >=59.5


On 25 April 2006 12:16, Christian Franke wrote:

> Hi,
> 
> the patch 2.5.8-8 options -Z and -T do not set filetime if the seconds
> part
> of the timestamp is greater or equal 59.5
> This is because maketime() does not handle "denormalized" times and
> returns an error on tm_sec = 60.
> The attached patch is a quick fix (and a testcase ;-) for this issue.
> 
> Christian

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? 


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]