Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 50
    Note that on Windows time.time() has ~16 milliseconds precision. Commented Dec 16, 2011 at 10:24
  • 7
    inaccurate on windows (useless) Commented Aug 21, 2017 at 12:47
  • 4
    time_ns does provide nano second resolution. But is it really precise on Windows? Seems no description about it in official document Commented Jun 19, 2019 at 9:14
  • 15
    @Jcyrss, time_ns does not provide nanosecond resolution, it just returns the time in nanoseconds. This may or may not improve the resolution. Measured clock resolutions for Linux and Windows are documented in PEP 564. For Windows, the measured resolution of time_ns was 318 us. Commented Jul 6, 2019 at 8:36
  • 13
    In python >=3.3 the answer is time.perf_counter() and time.process_time() Commented Nov 14, 2020 at 4:28