This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [Patch] patch -Z not working if timestamp contains seconds >=59.5
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/