clock offers basic time functions.
# Get the timestamp before and after sleeping for 1000 ms t0 = clock.time() clock.sleep(1000) t1 = clock.time() time_passed = t1 - t0 print(u'This should be 1000: %s' % time_passed)
Constructor to create a new
clock object. You do not generally call this constructor directly, because a
clock object is created automatically when the experiment is launched.
experiment-- The experiment object.
- Type: experiment
Sleeps (pauses) for a period.
# Create two canvas objects ... my_canvas1 = canvas() my_canvas1.text(u'1') my_canvas2 = canvas() my_canvas2.text(u'2') # ... and show them with 1 s in between my_canvas1.show() clock.sleep(1000) my_canvas2.show()
ms-- The number of milliseconds to sleep for.
- Type: int, float
Gives a current timestamp in milliseconds. The absolute meaning of the timestamp (i.e. when it was 0) depends on the backend.
t = clock.time() print(u'The current time is %f' % t)
- Type: float