python> datetime> get msec> msec = int (round (time.time () * 1000))% 1000

Operation check


CentOS 6.5

I want to get the msec of the current time.

reference 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)

result


[toLearn]$ python 151202a.py 
283
384
484

The msec value can be displayed approximately every 100 msec.

Recommended Posts

python> datetime> get msec> msec = int (round (time.time () * 1000))% 1000
python int is infinite
[Python] Get Qiita trends
python unix-time <-> datetime conversion
[Python3] Get date diff
Get date in Python
Get date with python
Python3> round (a --b, 7)
python get current time