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: Eli Zaretskii
Subject: Re: [bug-gawk] gawk with dates before 1970
Date: Tue, 14 Apr 2015 17:21:24 +0300

> Date: Mon, 13 Apr 2015 23:06:39 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Cc: address@hidden
> 
> I may be confused, but I think Eli's point was that time_t could be unsigned,

Yes.

> 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...

Not only that, but the above snippet also assumes that 'time_t' is not
wider than 'long'.  This is false at least on 64-bit Windows, and
probably also elsewhere.



reply via email to

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