bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs current-time-string core dump on 64-bit hosts


From: Paul Eggert
Subject: Re: Emacs current-time-string core dump on 64-bit hosts
Date: Sat, 18 Mar 2006 17:53:18 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Richard Stallman <rms@gnu.org> writes:

>     Personally, I find it preposterous that we need to reinvent library
>     functions.  Isn't there a better (safer) library function, or a
>     combination thereof, that we could use instead of rolling our own?
>
> I agree.
>
> Why not just check the input for being in a reasonable range?

It's difficult to do an exact check on the input, since the input
range depends on the time zone and on leap second support.  Doing an
exact check would involve far more code than the solution already
proposed.

If you're willing to settle for an approximate check, it depends on
how approximate you are willing to settle for.

If the input check would be "approximately January 2, 1001 through
approximately December 30, 9998 AD" (to avoid time zone and leap
second issues), then it would be somewhat tricky to write the code
portably, since the numbers involved will exceed 2**32.  And this
would reject a few valid inputs.

If the input check would be "only 32-bit time_t values", then it's
pretty easy.  But that will eliminate most of the valid inputs on a
64-bit host; and the code would stop working in 2038.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]