lua-users home
lua-l archive

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


The short answer is that Lua only supports the C89 specifiers. For the long
answer, see below.

> There was a change made in response to a bug I had earlier reported  
> about an error being reported if os.date was called with an empty  
> string.

Actually, the problem is larger than this: strftime cannot signal errors
reliably. The Linux man page says:

    Note that the return value 0 does not necessarily indicate an error;
    for example, in many locales %p yields an empty string.

On the other hand, calling strftime with unsupported specifiers is
undefined behaviour. In particular, some VC libraries are know to
crash if you do that.

So, to do it the right way requires that the format string be parsed and
checked for supported specifiers, which is probably what we're going to
have to do for the next version, boring as it is.

Sorry about that. Fighting silly C interfaces and faulty C libraries is a bore.
--lhf