'record audio and system time at a time in python

I am trying to record audio and system timestamp of the recorded time. I tried the following code, but the system time is not accurate since I am adding it manually,

import speech_recognition as sr
from datetime import datetime

r= sr.Recognizer()        
print("Start Time =", digit_zero_start1)
audio_data = r.record(source, duration=2)
digit_zero_end1 = current_milli_time()
print("End Time =", digit_zero_end1)
diff1 = digit_zero_end1 - digit_zero_start1

Please help to to do this job. Thanks in advance.



Sources

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

Source: Stack Overflow

Solution Source