That's not going to work - the scope of the timer is controlled by the lifetime of the ActivityTimer object - here you have reduced that lifetime to just the length of the if block, so the times gathered will be meaningless.