Last active
December 24, 2017 12:10
-
-
Save lhsfcboy/389ca272d32eb55637884496d7877e82 to your computer and use it in GitHub Desktop.
Get timestamp from python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time; | |
ts = time.time() | |
print(ts) | |
# 1514116641.1691682 | |
# 小数点后七位,也就是100ns | |
import datetime; | |
ts = datetime.datetime.now().timestamp() | |
print(ts) | |
# 1514116641.171174 | |
# 小数点后六位,也就是1微秒, 1us | |
import calendar; | |
import time; | |
ts = calendar.timegm(time.gmtime()) | |
print(ts) | |
# 整数表示的秒值 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment