[Top][All Lists]

[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: Fri, 24 Mar 2006 13:00:15 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     > I think it is possible, even trivial, to fix ctime.  The largest year
>     > value that can be represented in a 64-bit time-value is around 1
>     > trillion, and that will fit in 12 digits.  Isn't this trivial to fix?
>     No, because ctime is implemented in terms of localtime, localtime is
>     defined to use an 'int' to represent the year, and 'int' is only 32
>     bits on most hosts.
> I do not follow you.  If conversion to `int' truncates the year, that
> can cause incorrect results, but it can't cause the results to be any
> further out of range.  The year in `ctime' will still fit in 12 digits.


I had interpreted "fix ctime" to mean "ctime must always return a
string that contains the correct year, month, day, etc., assuming the
Gregorian calendar with no leap seconds".  But by "fix ctime" you
merely meant "ctime must never crash".  In that case, yes, a fix is
trivial, and the GNU C library's ctime implementation already does
that: its ctime always returns NULL (setting errno) with out-of-range

reply via email to

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