Time calculations: How can I calculate the difference between two time values?

GuiXT has built-in function for date calculations, but not for times. You have to do it manually. Example:


Set V[t1] "09:11:32"

Set V[t2] "17:21:04"


// seconds since 00:00:00 for t1

Set V[sec1] &V[t1](1-2)

Set V[sec1] &V[sec1] * 60

Set V[sec1] &V[sec1] + &V[t1](4-5)

Set V[sec1] &V[sec1] * 60

Set V[sec1] &V[sec1] + &V[t1](7-8)


// seconds since 00:00:00 for t2

Set V[sec2] &V[t2](1-2)

Set V[sec2] &V[sec2] * 60

Set V[sec2] &V[sec2] + &V[t2](4-5)

Set V[sec2] &V[sec2] * 60

Set V[sec2] &V[sec2] + &V[t2](7-8)


// difference in seconds and in minutes

Set V[diffsec] &V[sec2] - &V[sec1]

Set V[diffmin]  &V[diffsec] / 60 decimals=0

Message "Difference in minutes: &V[diffmin]"