About 10,800,000 results
Open links in new tab
  1. How do I get the current time in Python? - Stack Overflow

    How do I get the current time in Python? The time module. The time module provides functions that tell us the time in "seconds since the epoch" as well as other utilities. import time Unix Epoch Time. This is the format you should get timestamps in for saving in databases. It is a simple floating-point number that can be converted to an integer.

  2. 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 using time.time() function as a timer. To emulate /usr/bin/time in Python see Python subprocess with /usr/bin/time: how to capture timing info but ignore all other output?.

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

    kotai:~ chmullig$ cat sleep.py import time print "presleep" time.sleep(10) print "post sleep" kotai:~ chmullig$ python sleep.py presleep post sleep kotai:~ chmullig$ time python sleep.py presleep post sleep real 0m10.035s user 0m0.017s sys 0m0.016s kotai:~ chmullig$

  4. datetime - ISO time (ISO 8601) in Python - Stack Overflow

    I found the datetime.isoformat in the documentation.It seems to do what you want: datetime.isoformat([sep]) Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS If utcoffset() does not return None, a 6-character string is appended, giving the UTC offset in …

  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 time.clock() from Python 3.8. You can see more about it from issue #13270. This warning suggest two function instead of time.clock().

  6. datetime - How to get UTC time in Python? - Stack Overflow

    Apr 11, 2013 · The point is that you may want to change things on the function and for that reason is better stick to datetime object, not using time.time(), You could also use time.mktime(now.timetuple()) to convert directly to int. Anyway, for this simple case time.time() is also a valid option. What I find odd, is going by timedelta to find the seconds.

  7. python - Converting Epoch time into the datetime - Stack Overflow

    Sep 12, 2012 · First a bit of info in epoch from man gmtime. The ctime(), gmtime() and localtime() functions all take an argument of data type time_t which represents calendar time.

  8. how to measure running time of algorithms in python

    Oct 1, 2016 · Accurate timing of functions in python accurately measure time python function takes. How can i mesure and compare the running times of my algorithms written in python .Also point me to a nice algorithms site/forum like stackoverflow if you can.

  9. python - How do I make a time delay? - Stack Overflow

    We're building a database here that will be around for years to come, with people finding answers via Google, and lots of people never get around to reading the comments. This would make a great new question, even. Something along the lines of "How to make a time delay in Python while using tkinter" or similar. –

  10. In Python, how do you convert a `datetime` object to seconds?

    Dec 6, 2018 · it assumes that t is a local time. UTC offset for the local timezone may have been different in the past and if mktime() (C library) has no access to a historical timezone data on a given platform than it may fail (pytz is a portable way to access the tz database).

Refresh