Many of you may already realized this, but I just got myself clear until recent study and take a chance to share that. Qspice uses adaptive step size algorithms, and for example to use if(x,y,z) as a comparator implementation, you may find its output looks trapezoidal instead of square in a long run. Normally, I add .option MAXSTEP to limit maximum time step in simulation, but also significantly increase simulation time.
I just realized that, to utilize a device with TTOL (i.e. Switch, ¥-Device) can help. As TTOL allows one to determine how accurately the switch time should be found, if the comparator output flip event trigger switch action for a device with TTOL feature, extra time step can be added after switch action to achieve an instance response waveform.
Here is an example to compare with and without a buffer after B-source with if(x,y,z) as a comparator.
I just remind myself in many simulators, analog and digital requires an interface device, just like this simulation case. The only difference is that, originally, I didn’t consider this as a digital circuit as if(x,y,z) is not necessary be a 0/1 output but can be a formula or other stuff.
So, I am not sure if any other better method, but at least this can help to balance time step and simulation time.