This chapter shall apply to any debt alleged by way of setoff or counterclaim on the part of a defendant. The time of limitation of such debt shall be computed in like manner as if an action therefor had been commenced at the time when the plaintiff's action commenced.