Re: 7.4.1 ... slight change of scheduale ...
| От | Tom Lane |
|---|---|
| Тема | Re: 7.4.1 ... slight change of scheduale ... |
| Дата | |
| Msg-id | 17255.1070760544@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: 7.4.1 ... slight change of scheduale ... (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Список | pgsql-hackers |
Bruce Momjian <pgman@candle.pha.pa.us> 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
В списке pgsql-hackers по дате отправления: