Your best bet here is going to be using a cookie. Set a cookie with the timestamp when the first event is set, then when the second event fires, call the cookie and set a variable value based on the elapsed time.
- If you plan to use this as a dimension, you can either use the value in seconds, or use additional logic to put them in buckets.
- If you plan to use this as a metric, you can increment an event by the number of seconds that have elapsed. Recent appMeasurement libraries allow the format s.events="event1=10".