Bruce Momjian <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> That's no fix --- it will break the code on compilers without long long.
> Here are the emails describing the problem. Seems they should see how
> we do time differences in the backend as an example.
Now that I look at it, the code is already depending on long long, which
is silly given the low need for accuracy. For portability it should be
double instead:
double diff;
...
gettimeofday(&now, 0);
diff = (int) (now.tv_sec - then.tv_sec) * 1000000.0 + (int) (now.tv_usec -
then.tv_usec);
sleep_secs = args->sleep_base_value + args->sleep_scaling_factor * diff /
1000000.0;
(the (int) casts avoid assuming that the tv_sec and tv_usec fields are
of signed integer types). There's a "%lld" format string to fix too.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]