Python Time Module

Source: Internet
Author: User

Pythontime Module

[' _struct_tm_items ', ' __doc__ ', ' __loader__ ', ' __name__ ', ' __package__ ', ' __spec__ ', ' altzone ', ' asctime ', ' clock ', ' CTime ', ' Daylight ', ' get_clock_info ', ' gmtime ', ' localtime ', ' mktime ', ' monotonic ', ' perf_counter ', ' process_time ', ' Sleep ', ' strftime ', ' strptime ', ' struct_time ', ' time ', ' timezone ', ' tzname '

1.time ()

The core function of the time module is time (), which returns the number of seconds from the beginning of the era, the return value is a floating point, and the specific precision depends on the platform.

2.ctime ()

Floating-point numbers are typically used to store and compare dates, but not friendly to humans, and to record and print time, you can use CTime ().


3. Clock ()

Clock () returns the processor clock time, and its return value is typically used for performance testing and benchmarking. So they reflect the

The actual running time of the program.


4. Gmtime () and localtime ()

Gmtime () is used to get the UTC time, LocalTime () is used to get the current time zone, UTC time is actually Greenwich mean time, and it has a eight hour lag with China.


5. strptime ()

Used to convert string time to Struct_time format


6. strftime ()

Formatted output for TIME


7. mktime ()

A floating-point number that is used to convert struct_time into time


8. Sleep ()

The sleep function is used to hand over the current thread, asking it to wait for the system to wake it up again, and if the write program has only one thread, it will actually block the process and do nothing.

Python Time Module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.