On Mon, 2007-10-29 at 00:24 +0000, Paul Martin wrote:
> On Sun, Oct 28, 2007 at 10:07:59PM +0000, Mark Scott wrote:
> > I have a home-built radio clock receiver for the DCF77 time signal
> > that has been working fine for a year while attached to an i386
> > machine.  I moved it to an amd64 machine and find that radioclkd
> > segfaults when decoding the DCF77 signal.
> 
> radioclkd tries a binary chop across the full range of time_t, starting with
> the middle value that the type can hold. Unfortunately, gmtime() doesn't
> like handing the value 0x4000000000000000
> 
> What happens if you add the following line at line 213 in radioclkd.c?
> 
>       /* calculate the number of magnitude bits in a time_t */
>       for (bits=0,timep=1;timep>0;bits++,timep<<=1)
>               ;
> 
> +     if (bits > 48) bits = 48;
> 
>       /* if time_t is signed, 0 is the median value else 1<<bits is median */
>       timep = (timep<0) ? 0 : ((time_t) 1<<bits);
> 
> 
> This limits the range of time_t values to years 1970 to 8921556. If we're
> still using longwave radio clocks in eight million years time, we've got
> major problems.

Given that all the longwave radio clocks only broadcast two digit year
numbers, eight million years is not a problem.

However surely this is a libc bug and not a radioclkd bug. It is not in
my opinion appropriate in an open source system to patch radioclkd to
work around a bug in libc. We have access to the source of libc and the
gmtime function should be fixed in libc. It has the benefit of fixing
bugs in other programs potentially before they even manifest themselves.
I guess the problem is that libc is not 64bit clean :-(


JAB.

-- 
Jonathan A. Buzzard                 Email: jonathan (at) buzzard.me.uk
Northumberland, United Kingdom.       Tel: +44 1661-832195






-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to