As a psychologist, it's useful to be able to time people's reactions in milliseconds. What kind of accuracy could I expect to get in this regard from Python? From what I've read so far, it doesn't look like I can hope to get precise enough timing to get reliable results, but I'm having difficulty finding good sources. Anyone out there know for sure?
aot
0
Junior Poster in Training
Recommended Answers
Jump to PostI'm not sure you'll get meaningful results from anything mouse-and-keyboard driven *because* the mouse and keyboard events can sometimes take unpredictable amounts of time to be passed along to your program.
I'm not a hardware expert, so I could be wrong about that ... but at least keep the …
Jump to PostIf you have a windows machine, you can achieve accuracy better than 1 millisecond with time.clock() ...
# time.clock() gives wallclock seconds accurate to at least 1 millisecond # it updates every millisecond, but only works with windows # time.time() is more portable, but has quantization errors …
Jump to PostI dont know about python but i assume that like most other languages, there are certain datatypes that offer greater precision?
Jump to PostThe datetime module will do micro-seconds
import datetime print datetime.datetime.now() time_now = datetime.datetime.now() print time_now
All 14 Replies
jrcagle
77
Practically a Master Poster
aot
0
Junior Poster in Training
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
jbennet
1,618
Most Valuable Poster
Team Colleague
Featured Poster
aot
0
Junior Poster in Training
woooee
814
Nearly a Posting Maven
jrcagle
77
Practically a Master Poster
Ene Uran
638
Posting Virtuoso
woooee
814
Nearly a Posting Maven
jrcagle
77
Practically a Master Poster
aot
0
Junior Poster in Training
Ene Uran
638
Posting Virtuoso
aot
0
Junior Poster in Training
BBTK
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.