1start_ticks=pygame.time.get_ticks() #starter tick
2while mainloop: # mainloop
3 seconds=(pygame.time.get_ticks()-start_ticks)/1000 #calculate how many seconds
4 if seconds>10: # if more than 10 seconds close the game
5 break
6 print (seconds) #print how many seconds