Python Forum
need better than time.time() - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: need better than time.time() (/thread-17228.html)



need better than time.time() - Skaperen - Apr-03-2019

when running fast, two calls to time.time() can return the same value. time.time() does do better than one second resolution but not good enough for each call to be unique without slowing the code. does anyone know of a better source of discrete time? i am doing this on Linux so a Linux-only solution is adequate though a portable solution would be preferred. this may be OS-limited in terms of actual time resolution available. but i prefer a Python solution until i learn to do C calls in Python. i don't know if there is even a solution in C because of the OS-limit.


RE: need better than time.time() - Larz60+ - Apr-03-2019

python 3.7: time.time_ns()


RE: need better than time.time() - Skaperen - Apr-04-2019

i wish Ubuntu would upgrade Python 2nd level version within their apt-get dist-upgrades.