LoginSignup
0
1

More than 5 years have passed since last update.

python > datetime > msecを取得する > msec = int(round(time.time() * 1000)) % 1000

Last updated at Posted at 2015-12-01
動作確認
CentOS 6.5

現在時刻のmsecを取得したい。

参考
http://stackoverflow.com/questions/5998245/get-current-time-in-milliseconds-in-python

151202a.py
import time

for loop in range(0,3):
    msec = int(round(time.time() * 1000)) % 1000
    print msec
    time.sleep(0.1)
結果
[toLearn]$ python 151202a.py 
283
384
484

だいたい100msecごとにmsecの値が表示できている。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1