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: Mon, 13 Apr 2015 23:06:39 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Apr 13, 2015 at 04:30:03PM +0300, Aharon Robbins wrote:
> > You cannot just delete those lines, because some systems have time_t
> > as an unsigned data type.
> 
> The actual variable used is a long, in order to be able to
> test for < 0.  But removing them doesn't seem to cause any
> problems.

I may be confused, but I think Eli's point was that time_t could be unsigned,
so when the code says:

        time_t fclock;
        long clock_val;

        clock_val = <value of 2nd argument>
        fclock = (time_t) clock_val;

the value could be changed.  In that case, strftime would give an unexpected
result.  In general, we're stuffing a double-precision or MPFR value
into a time_t.  Should we check after the conversion that we haven't
mutilated the value?  Either of those assignments could alter the value...

Regards,
Andy



reply via email to

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