Python function ---- Time

I'm a python novice, my first blog about the process of learning it, after more we study and then gradually complement or correct notes.

Time first look at the parameters under dir (__XX__) does not require, where not list:

1 ['_STRUCT_TM_ITEMS','altzone', 'asctime', 'clock', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'perf_counter', 'perf_counter_ns', 'process_time', 'process_time_ns', 'sleep', 'strftime', 'strptime', 'struct_time', 'thread_time', 'thread_time_ns', 'time', 'time_ns', 'timezone', 'tzname']

There are the following parameters and methods:

1. altzone: return home time UTC_GMT Greenwich (UK Observatory), offset in seconds, to the east is negative (> 0, the Americas; <= 0 most of Europe, Asia, Africa).

    Syntax: time.altzone ()   

 
 
import time

def procedure():
time.sleep(2.5)

#clock time
t0=time.clock()
procedure()
print (time.clock () - t0, 'clock time')

#time time
t0=time.time()
procedure()
print (time.time() - t0, "time时间")

# Time.process_time time
t0=time.process_time()
procedure()
print (time.process_time () - t0, 'run time, sleep time does not include')

# Time.perf_counter time
t0=time.perf_counter()
procedure()
print (time.perf_counter () - t0, 'system uptime ")
 
# Return results
# 2.500562347 Time Clock
# 2.500372886657715 Time Time
# 0.0 running time
# 2.4999300269999996 system uptime

3. 

 

Guess you like

Origin www.cnblogs.com/zzh-zjh/p/11223022.html