import time time.time() #returns the unix timestamp

Read more of this post