[Top][All Lists]

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

Re: [Bug-gnulib] xctime

From: Paul Eggert
Subject: Re: [Bug-gnulib] xctime
Date: Sat, 18 Sep 2004 22:16:13 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> Do ctime_r ever return a string longer than 26 characters?

Yes, in some implementations.  In practice I suspect that the behavior
is undefined if the output would be longer than 26 bytes.

> Taking into account locales etc?

No, it's locale-independent.  But years can have more than 4 digits if
time_t is sufficiently wide (e.g., 64-bit time_t hosts, which are
becoming more common).

I don't think it's worth putting ctime-related stuff into gnulib.
ctime is an obsolescent interface that is kept around because it was
the only easy way to generate strings back in 1977, so lots of old
software uses it.  And in practice ctime is buggy on many platforms
unless 0 <= time_t < 2**31.

strftime is the way to go.

reply via email to

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