About 344,000 results
Open links in new tab
  1. How do I measure elapsed time in Python? - Stack Overflow

    The python cProfile and pstats modules offer great support for measuring time elapsed in certain functions without having to add any code around the existing functions. For example if you …

  2. datetime - How to use Python to calculate time - Stack Overflow

    Note that it doesn't make sense to do addition on just a time (but you can combine a date and a time into a datetime object, use that, and then get the time). DST is the major culprit. For …

  3. How do you calculate program run time in python? [duplicate]

    Thanks! This worked great. One note for others who may be using timeit for the first time, you will need to import locally defined symbols via timeit's setup parameter. For example (if …

  4. How do I get time of a Python program's execution?

    Oct 13, 2009 · I want to time the whole program. $ python -mtimeit -n1 -r1 -t -s "from your_module import main" "main()" It runs your_module.main() function one time and print the elapsed time …

  5. How do you determine a processing time in Python?

    DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead So python will remove …

  6. Calculating computational time and memory for a code in python

    Aug 9, 2012 · Use this for calculating time: import time time_start = time.clock() #run your code time_elapsed = (time.clock() - time_start) As referenced by the Python documentation: …

  7. python - How to calculate the time interval between two time …

    Here's a solution that supports finding the difference even if the end time is less than the start time (over midnight interval) such as 23:55:00-00:25:00 (a half an hour duration):

  8. python - Calculating Time Difference - Stack Overflow

    Aug 6, 2010 · Regardless of language, monotonic time is the right answer, and real time is the wrong answer, for consistently measuring durations that aren't very long. Monotonic time …

  9. python - How to calculate number of days between two given …

    Sep 29, 2008 · For example, in the following example, the time difference between the two datetimes is 5 hours and if we use timedelta.days to get the number of days, that difference …

  10. Do calculations on datetime in Python - Stack Overflow

    Dec 12, 2013 · You have to make the difference between datetime.datetime (which is an actual date and time, for example "1899-12-30 19:45:00") and datetime.timedelta (which is a period, …

Refresh