sciris.sc_datetime.timedsleep

timedsleep(delay=None, start=None, verbose=True)[source]

Delay for a certain amount of time, to ensure accurate timing.

Parameters
  • delay (float) – time, in seconds, to wait for

  • start (float) – if provided, the start time

  • verbose (bool) – whether to print activity

Example:

for i in range(10):
    sc.timedsleep('start') # Initialize
    for j in range(int(1e6)):
        tmp = pl.rand()
    sc.timedsleep(1) # Wait for one second including computation time