Time module in Python provides various time-related functions. This module comes under Python’s standard utility modules.
time.time_ns() method of Time module is used to get the time in nanoseconds since the epoch. To get the time in seconds since the epoch, we can use
The epoch is the point where the time starts and is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. To check what the epoch is on a given platform we can use time.gmtime(0).
time.time_ns() method is new in Python version 3.7
No parameter is required.
This method returns an integer value which
represents the time in nanoseconds since the epoch.
Code: Use of
epoch is: Thu Jan 1 00:00:00 1970 Time in seconds since the epoch: 1567451658.4676464 Time in nanoseconds since the epoch: 1567451658467647709
- class method vs static method in Python
- Python | set() method
- Python | os.dup() method
- Python | next() method
- Python | os.sched_get_priority_max() method
- Python | Tensorflow exp() method
- Python | sympy.has() method
- Python | getattr() method
- Python | os.sched_rr_get_interval() method
- Python | sympy.crt() method
- Python | os.removedirs() method
- Python PIL | getpixel() Method
- Python | sympy.apart() method
- Python | os.chroot() method
- Python | sympy.Mul() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.