I am not sure to get your question, but I you want to store as a variable the time spent on a question, on a range of question, etc... you should inspired yourself from the code below (it comes from this post: https://sawtoothsoftware.com/forum/4590/how-to-record-survey-time-in-a-sawtooth-variable?show=4590#q4590
Basically create a free-format question and write as follow if you want to capture the time (in minutes) spent between pages 1 and 50:
<input type="hidden" name="capture_time" value="
Begin Unverified Perl
my $a1=(PAGETIME(1,50))/60 ;
It is typical to put this at the very end of the survey, but I guess it sould also work elsewhere. At the extreme you could have such hidden variable between each of your page, measuring the time spent on the previous page.