Saving time spent in each passage

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.14
Story Format: Harlowe

Hello there!

I’m following this post (Tiltfactor | How to Record What Your Playtesters are Doing in Your Unity or Twine Games) on how to save the player history/actions into Qualtrics.

So aside from the $actions variable, I also wanted to save the time spent of the player in each passage. How should I update the code so I can also record the time (in seconds/milliseconds) spent in Qualtrics?

Many thanks!