Getting the difference between time questions, inside a repeat group

Dear CommCare Users,
Kindly help me understand why I can’t get the following to work. I have the questions in the form as below:

report_details //this is a group inside the form containing the repeat group

total_air_jetting_cycle_time=sum(#form/report_details/air_jetting_cycle/cycle/cycle_time) //null

air_jetting_cycle                                            //this is a repeat group
  cycle                                                           //this is a question list
     start_time                                                //this is a Time Question Type 
     end_time                                                  //this is a Time Question Type 
     cycle_time=double(double(../../cycle/end_time) - double(../../cycle/start_time))  //null

So my question is why am I getting a blank or null value for total_air_jetting_cycle_time and cycle_time?

Thanks and kind regards,
Chaiwa.

Hi Chaiwa,

Unfortunately it’s not possible to directly compare time questions in this manner. A number of circumstances like 23:59 start and 00:21 end, or a daylight savings time switch could result in situations where the amount of time between the two values is ambiguous or wrong.

Due to the number of situations where inputting and subtracting times can become confusing, we generally recommend asking users to manually provide “time since” the starting time, rather than collecting both and trying to resolve.

The time data is collected in a consistent, ISO8601 format, though, so if needed you could pull out the Hour and Minute portions and manually apply the math, but keep in mind that you’d still need to provide users with a way to resolve any ambiguity associated with the fact that 1:45AM is sometimes only 20 minutes before 3:05AM.

-Clayton