time.time
Get the current time in seconds since January 1, 1970 (UTC).
Python 3.13
time.time()Return value
A float: seconds with a fractional part.
Examples
Seconds since 1970
Python 3.13
import time
print(time.time() > 1_700_000_000)True
How much time has passed
Python 3.13
import time
start = time.time()
time.sleep(0.2)
print(round(time.time() - start, 1))0.2
Details
This is a Unix timestamp: a single number that does not depend on the time zone. The difference between two calls shows how many seconds have passed. For precise timing of short intervals, time.perf_counter is better, and for working with dates there is the datetime module.
