'thread for exact time python

I also need to wait for about 1 s by thread.

I've tried this code to access period of thread, but sometimes its actually 1s and other times it takes much longer. Why does it happen?

import threading
import time

i=0
def task():

    global t_period
    t_period1   = time.time() - t_period
    t_period = time.time()
    t=threading.Timer(1,task)
    t.start()

    print( t_period1 )




t_period = time.time()
t=threading.Timer(1,task)
t.start()   


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source