[tz] [PATCH] * zdump.c: Tune performance of -c with large numbers on 64-bit hosts.

Tony Finch dot at dotat.at
Thu Aug 15 08:59:06 UTC 2013

Paul Eggert <eggert at cs.ucla.edu> wrote:

> +#define SECSPER400YEARS	(SECSPERNYEAR * (intmax_t) (300 + 3)	\
> +			 + SECSPERLYEAR * (intmax_t) (100 - 3))

i.e. 12 622 780 800

> +			if (INTMAX_MAX / SECSPER400YEARS < diff400)
> +				return absolute_max_time;

I think this is a constraint violation on 32 bit systems that don't have
long long (e.g. C89), so it ought to cause a compilation error.

C99 section 6.6 "constant expressions" paragraph 4 under "constraints"

  Each constant expression shall evaluate to a constant that is in the
  range of representable values for its type.

C89 has the same requirement.

I think (sadly) you'll have to use #ifdef on SECSPER400YEARS_FITS

f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
Forties, Cromarty: East, veering southeast, 4 or 5, occasionally 6 at first.
Rough, becoming slight or moderate. Showers, rain at first. Moderate or good,
occasionally poor at first.

More information about the tz mailing list