You can use unixtime expression. It's a real-time clock on the device.
When the upgrade button is clicked, save unixtime in local storage.
To check how much time has passed:
int((unixtime-saved_unixtime)/1000)=number of seconds
int((unixtime-saved_unixtime)/60000)=number of minutes