ok, partially solved. I found the rex_date plugin that allows me to do date.UnixTimestamp. So I just need to subtract one from the other to get a difference in seconds.
So now I need to work out how to tell if the player has minimized the game on a mobile platform so I know when to call it.
Any ideas?