expyriment.misc.Clock

class expyriment.misc.Clock(sync_clock=None)

Basic timing class.

Unit of time is milliseconds.

__init__(sync_clock=None)

Create a clock.

Parameters:
sync_clockmisc.Clock, optional

synchronise clock with existing one

property cpu_time

OBSOLETE property: Please use monotonic_time().

property init_localtime

Getter for init time in local time

property init_time

Getter for init time in milliseconds.

static monotonic_time()

Returns the time of the high-resolution monotonic timer that is used by Expyriment internally.

reset_stopwatch()

“Reset the stopwatch.

The use of the stopwatch does not affect the clock time.

property stopwatch_time

Getter for time in milliseconds since last reset_stopwatch.

The use of the stopwatch does not affect the clock time.

property time

Getter for current time in milliseconds since clock init.

wait(waiting_time, callback_function=None, process_control_events=False)

Wait for a certain amount of milliseconds.

Parameters:
waiting_timeint

time to wait in milliseconds

functionfunction, optional

function to repeatedly execute during waiting loop

process_control_eventsbool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = False)

Returns:
quit_eventexpyriment.control.CallbackQuitEvent object

the callback quit even in case a wait function has been registered

wait_minutes(time_minutes, callback_function=None, process_control_events=False)

Wait for a certain amount of minutes.

Parameters:
time_minutesint

time to wait in minutes

callback_functionfunction, optional

function to repeatedly execute during waiting loop

process_control_eventsbool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = False)

Returns:
quit_eventexpyriment.control.CallbackQuitEvent object

the callback quit even in case a wait function has been registered

wait_seconds(time_sec, callback_function=None, process_control_events=False)

Wait for a certain amount of seconds.

Parameters:
time_secint

time to wait in seconds

callback_functionfunction, optional

function to repeatedly execute during waiting loop

process_control_eventsbool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = False)

Returns:
quit_eventexpyriment.control.CallbackQuitEvent object

the callback quit even in case a wait function has been registered