bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk with dates before 1970


From: Andrew J. Schorr
Subject: Re: [bug-gawk] gawk with dates before 1970
Date: Tue, 14 Apr 2015 08:15:44 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

On Tue, Apr 14, 2015 at 07:26:37AM -0300, Glaudiston Gomes da Silva wrote:
> Your comments are based on the first email's thread. After that I realize a
> better way that just comment and did another sugestion, to verify the type
> for signed/unsigned, and for unsigned, ok for fatal this, but if signed
> ignore this fatal:
> 
> https://lists.gnu.org/archive/html/bug-gawk/2015-04/msg00015.html
> 
> This way I think it keeps the current behavior to unsupported(unsigned)
> systems and improve this functionality to all signed systems.

Thanks for bringing this up, but your issue is only one part of the problem.
We have two flaws in the current code:

1. We should check the return code from localtime/gmtime to make sure that it
is not NULL.  Currently, if the time_t value is outside the range supported by
the C library, we get back a NULL pointer that we then blindly pass to
strftime, and that results in a crash.  The question then becomes whether we
should issue a fatal error or return an empty string.  I'm not a big fan of
fatal errors...

2. There's a general question of how to handle the case where the
floating-point timestamp argument cannot be converted to a time_t that
preserves its value.  This goes beyond the signed/unsigned concern that
Eli raised.

Regards,
Andy



reply via email to

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