How can I figure the number of seconds in RM?

Hi All,
I have been looking at RM
there is an option for the difference between minutes
I need to count the number of seconds
I have a Variable time1 string %now% gives me 09:55:14 AM then I have time2 string %now% gives me 09:55:55 AM
How can I figure the number of seconds in RM?
Thanks

The easy way is to set a variable to current_time that is already in seconds or milliseconds from some point in the past, rather than using %now%
subtract current_time variable from lastSeconds variable = duration in seconds

The hard way
Convert the time to seconds.
Hours x 3600 +
Minutes x 60 +
Seconds
If it's PM add 43200 seconds
if nowInSecs < lastInSec (there was a date change and assuming it's just one day)
add 86400 to nowInSecs for each day if you know

I was using %now% to get the time with seconds at the start of the rule and end is there a better way to do it?

Define three variables
name lastTime; Type: Number; initial value: 0
name currTime; Type: Number; initial value: 0
name duration; Type: Number; initial value 0

Actions
set lastTime to curr time in seconds
wait for event or condition
set currTime to curr time in seconds
variable math currTime - lastTime = duration (in seconds)

How to set a variable to seconds
image

Don't use a time variable, just use a number variable and set it to current time. This will set the variable to the current unix time (not the time of day). Then it is easy.

Unix time started on January 1st, 1970. The values you see in my screenshot above are the number of seconds elapsed since January 1st, 1970. Easy to figure out the difference between these two numbers, which is already in seconds.

Note, you can count unix time in the number of milliseconds since January 1st, 1970 as opposed to the number of seconds. RM gives you the choice. For most needs, seconds will suffice.