Python Time Time() Method



Python time system time() revisits the time as a suspended point number articulated in seconds while the period, in UTC. Even while the time is always revisited as a floating end number, not the entire system's supply time with an improved exactitude of 1 second. While this meaning usually returns non-decreasing keys, it can arrive at a lower charge than a preceding call if the arrangement clock has been set back between the two calls.


Following is the syntax for time() method:



  • NA

Return Value

This method returns the time as a floating-point number expressed in seconds since the epoch, in UTC.


The following example shows the usage of time() method.

import time

print "time.time(): %f " %  time.time()
print time.localtime( time.time() )
print time.asctime( time.localtime(time.time()) )

When we run the above program, it produces the following result:

time.time(): 1234892919.655932
(2009, 2, 17, 10, 48, 39, 1, 48, 0)
Tue Feb 17 10:48:39 2009

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.