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 15:17:56 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Apr 14, 2015 at 09:37:24PM +0300, Eli Zaretskii wrote:
> > From: Aharon Robbins <address@hidden>
> > Date: Tue, 14 Apr 2015 21:25:30 +0300
> > Cc: address@hidden, address@hidden, address@hidden
> > 
> > > IOW, it's a simple generalization of the current test: instead of
> > > looking only at the sign, make sure the value is between the minimum
> > > and the maximum allowed limits, and if not, yell bloody murder.
> > 
> > I'm not so sure it's simple. You have to know
> > 
> > - time_t is signed / unsigned / floating point
> > - time_t is 32 or 64 bits if integer
> > 
> > Sounds like a bunch of autoconf machinery to determine these things
> > and then a bunch of ugly tests to check if you have the macros for
> > min/max signed/unsigned long/longlong and then if the values are in range.
> > (GNULIB fodder, essentially.)
> > 
> > If it really is simple, please show me the code...
> 
> There are 2 macros in Gnulib's intprops.h, called TYPE_MINIMUM and
> TYPE_MAXIMUM, which is all that we need.  Never mind their insanely
> complex definitions, we just need to steal them, put them on some Gawk
> header, and then use them.

If -M were not in play, would this work?

   time_t fclock;

   force_number(t2);
   fclock = t2->numbr;
   if ((double) fclock != trunc(t2->numbr)) {
      /* the value was not preserved */
   }

The need to support MPFN and MPZN formats makes it considerably more
complicated...

Regards,
Andy



reply via email to

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