Creating delay loop in C++

Hi Rob,

May I confirm, that the parameter t in Trunc() is the proposed future timestep?
I always thought that future timestep is t + *timestep. Though honestly I never make a validation on this.

extern "C" __declspec(dllexport) void Trunc(struct sDELAY_X1 *inst, double t,
    union uData *data,
    double *timestep) {   // limit the timestep to a tolerance if the circuit
                          // causes a change in struct sDELAY_X1
  double ttol = 1e-9;

  // if proposed next simulation time (t) > next timeout, shorten timestep to
  // next timeout
  if (t > inst->timeout_t) ttol = t - inst->timeout_t;
  *timestep = ttol;
}