Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to make thread sleep less than a millisecond on windows?

Answer Posted / Kramank Rajput

In Windows, the smallest granularity for thread sleep is 15.625 microseconds. However, you can work around this limitation by using the `time.perf_counter()` function from Python's time module to achieve sub-millisecond accuracy.nHere's an example:n``pythonnimport timenimport threadingnndef sleep_less_than_ms(ms):n start = time.perf_counter()n elapsed = 0n while elapsed < ms:n if time.perf_counter() - start >= ms:n breakn elapsed += 1e-6n nif __name__ == '__main__':n threading.Thread(target=sleep_less_than_ms, args=(500,)).start()`

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the next version of windows after 10?

965


How much does a windows 10 license cost?

921


What does it cost to upgrade to windows 10?

915


What is the latest version of microsoft edge for windows 10?

892


How much does it cost for a copy of windows 10?

860


What is the next windows after 10?

939


How does registry work wedding?

879


How much does a copy of windows 10 cost?

890


What is the latest windows operating system?

1040


When will the next windows os come out?

883


How do I add a google account to windows 10?

905


What is the current version of windows 10?

932