+ /* To avoid precision loss due to typecasting from int64_t to double */
+ if (params->rate != 1.0) {
+ rate_prod = (int64_t)(params->rate * (double)((int64_t)local_ts_ns - (int64_t)params->base_local_ts));
+ } else {
+ rate_prod = (int64_t)local_ts_ns - (int64_t)params->base_local_ts;
+ }