#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import datetime,shutil,os
import calendar

print(time.time())
print(time.localtime(time.time()))

print(time.asctime(time.localtime(time.time())))

# 格式化成2016-03-20 11:45:39形式
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))

# 格式化成Sat Mar 28 22:24:24 2016形式
print(time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()))

# 将格式字符串转换为时间戳
a = "Sat Mar 28 22:24:24 2016"
print(time.mktime(time.strptime(a, "%a %b %d %H:%M:%S %Y")))

len=calendar.firstweekday()

lena=calendar.month(2018,3,w=2,l=1)
lena=calendar.calendar(2018,w=2,l=1,c=6)
print(lena)


len=calendar.leapdays(2006,2018)
len=calendar.isleap(2018)
print(len)

lenb=calendar.weekday(2018,3,28)
print(lenb)

# calendar.timegm()
print(time.gmtime())
year=2018
month=4
day=10
lenc=calendar.monthrange(year,month)
lenc=calendar.monthcalendar(year,month)
lenc=calendar.weekday(year,month,day)
lenc=calendar.calendar(year, w=1, l=1, c=3, m=3)
lenc=calendar.month(year,month,w=2,l=1)
lenc=calendar.timegm((2017, 7, 24, 11, 19, 0, 0, 0, 0))
lend=time.gmtime(lenc)



lenf=time.mktime(time.strptime(lend,'%Y-%m-%d %H:%M:%S'))
# print(lend)
print(lenf)
print(lenc)

def procedure():
time.sleep(2.5)

t0=time.clock()
procedure()
print(time.clock()-t0)

t1=time.time()
procedure()
print(time.time()-t1)

lena=time.altzone
print(lena)

t=time.localtime()
lena=time.asctime(t)
lena=time.ctime()

print(lena)

os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'
time.tzset()
print(time.strftime('%X %x %Z'))

print(dir())
print(help(time))

lena01,lena02=time.timezone,time.tzname
print(lena01,lena02)

# 返回格林威治西部的夏令时地区的偏移秒数
lena1=time.altzone
print(lena1)

# 接收时间元组,返回字符串表示可读的当地日期时间
lena2=time.asctime(time.localtime())
print(lena2)

# 以浮点方式计算的描述返回当前CPU的时间
lena3=time.clock()
print(lena3)

# 接收时间元组,返回时间戳
lena4=time.mktime(time.localtime())
print(lena4)

# 接收时间元组,返回字符串表示的当地日期时间
lena5=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
print(lena5)

# 接收字符串表示的日期时间,返回时间元组
lena6=time.strptime(lena5,'%Y-%m-%d %H:%M:%S')
print(lena6)

# 接收时间戳,返回当地时间时间元组
lena7=time.localtime(time.time())
print(lena7)

# 接收时间戳,返回格林威治天文时间时间元组
lena8=time.gmtime(time.time())
print(lena8)

# 返回当前时间戳
lena9=time.time()
print(lena9)