My first thought is cannot be done because game is not running, but you could save PC/phone's time to local storage every second or so ( necessary because you have no idea when they will exit the game ), then when game starts up again load that saved date/time and compare against current date/time. The difference will be the time between their last exit and current start up of game