Python Forum
need better than time.time()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need better than time.time()
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
python 3.7: time.time_ns()
Reply
#3
i wish Ubuntu would upgrade Python 2nd level version within their apt-get dist-upgrades.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Check time within specific time ranges basvdm 3 1,302 Jan-20-2025, 05:10 PM
Last Post: Gribouillis
Question [SOLVED] [datetime.strptime] ValueError: time data 'foo' does not match format 'bar' Winfried 1 3,096 Jan-02-2025, 02:09 AM
Last Post: lyly19
  Help about a specific time selection QJZ 0 862 Dec-01-2024, 11:25 AM
Last Post: QJZ
  How to move an object over time rather than instantly? temlotresid6 3 3,304 Oct-23-2024, 11:20 AM
Last Post: temlotresid6
  Is there a difference between Python’s time.sleep and win32api.Sleep? phpjunkie 4 1,970 Sep-21-2024, 05:17 PM
Last Post: aakritiintelligence
  How to insert text time - into video frames? oxidian 0 2,674 Aug-25-2024, 04:51 PM
Last Post: oxidian
  Using RTC time in Rasberry Pi Programs sab201 1 1,545 Aug-18-2024, 05:50 PM
Last Post: snippsat
  Schedule exit a program at a specific time 4 am every day. chubbychub 3 2,307 May-17-2024, 03:45 PM
Last Post: chubbychub
  Filer and sort files by modification time in a directory tester_V 5 3,988 May-02-2024, 05:39 PM
Last Post: tester_V
Question Convert UTC now() to local time to compare to a strptime() Calab 2 2,922 Apr-29-2024, 07:24 PM
Last Post: deanhystad

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.