Python time.thread_time_ns() Function Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report Python time.thread_time_ns() function is used to return the value of the sum of the system and user CPU time of the current thread. It is similar to time.thread_time() function. The difference is thread_time() function return the seconds of the CPU(Computer time) but thread_time_ns() function return the nano-seconds of the CPU(Computer time) Syntax: time.thread_time_ns() Return: nanoseconds of the computer time Example 1: Python program that uses thread_time_ns() function Python3 # import time module import time # thread_time_ns() demo print(time.thread_time_ns()) Output: 3633875824 Example 2: Python program that demonstrates thread_time_ns() function by sleeping some seconds Python3 # import time module import time # thread_time_ns() demo print(time.thread_time_ns()) # sleep for 10 seconds time.sleep(10) # thread_time_ns() demo print(time.thread_time_ns()) # sleep for 2 seconds time.sleep(2) # thread_time_ns() demo print(time.thread_time_ns()) # sleep for 2 seconds time.sleep(2) # thread_time_ns() demo print(time.thread_time_ns()) Output: 3616352715 3616782418 3617173584 3617551725 Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills, become a part of the hottest trend in the 21st century.Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve. Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 05 Nov, 2021 Like Article Save Article Previous Python time.thread_time() Function Next Python time.tzset() Function Share your thoughts in the comments Add Your Comment Please Login to comment...