record duration when stop task