I like that solution since I believe there are 64-bit platforms where
long is 32-bits. I've updated my development version thus:
//
// timeValue.tv_sec is 64-bit since Linux kernel 5.6 but GMP
doesn't yet have support
// for long long which is a problem on platforms where long is
less than 8 bytes.
//
#if SIZEOF_LONG < 8
double seconds = timeValue.tv_sec;
#else
long seconds = timeValue.tv_sec;
#endif
mpz_class nanoSeconds(seconds);
Of course I expect to drop support for 32-bit before 2038 - certainly
when one our dependencies drops support. But I've gotten a bug report
for building Maude on a Raspberry Pi.
Steven
On 4/10/24 14:59, Aaron M. Ucko wrote:
Steven Eker <e...@csl.sri.com> writes:
This is harmless on 64-bit architectures since Index will be a signed
64-bit integer and if it works on 32-bit architectures, it's a work
around until GMP is fixed (hopefully before 2038).
I know this suggestion is unorthodox, and quite possibly moot at this
point in the context of official Debian packages -- but you might want
to consider formally going through double here, at least on the relevant
platforms. Precision loss shouldn't be a concern for another 140
million years or so by my reckoning, and I expect the additional
conversion overhead would be negligible in practice.
Thanks!