1 Matching Annotations
  1. Dec 2023
    1. Measure Execution Time With time.time()

      The time.time() function reports the number of seconds since the epoch (epoch is January 1st 1970, which is used on Unix systems and beyond as an arbitrary fixed time in the past) as a floating point number.

      The result is a floating point value, potentially offering fractions of a seconds (e.g. milliseconds), if the platforms support it.

      The time.time() function is not perfect.

      It is possible for a subsequent call to time.time() to return a value in seconds less than the previous value, due to rounding.

      Note: even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.