I only based the time on the ingame timer, the level starts at 300 and then I look at what time is left when the level is completed.