使用Python获取本地时间以及URC时间
#!/usr/bin/env python
import time
output={}
def __get_time_info():
time_info = {}
now_time = time.time()
time_info["local_time"]=time.strftime("%s",time.localtime(now_time))
time_info["utc_time"]=time.strftime("%s",time.gmtime(now_time))
#time_info["time_zone"]=time.timezone
return time_info
if __name__ == '__main__':
output=__get_time_info()
print output
[root@bogon time]# python time_info.py
{'local_time': '1512042924', 'utc_time': '1512014124'}