VOOZH about

URL: https://www.geeksforgeeks.org/python/python-time-thread_time_ns-function/

⇱ Python time.thread_time_ns() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python time.thread_time_ns() Function

Last Updated : 5 Nov, 2021

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

Output:

3633875824

Example 2: Python program that demonstrates thread_time_ns() function by sleeping some seconds

Output:

3616352715
3616782418
3617173584
3617551725
Comment
Article Tags: