# handler function

Asked by ONG YI CHONG on 2018-12-12

The docs say that the observation is paused until the handler function is returned. Does that mean that the observation time is paused if the handler function is called ? say if you observe for 1 second, and at t = 0.5, the handler function is called, Then once handler code has completed, the observation timer continues at t = 0.5 ? Just checking my understanding here.

## Question information

Language:
English Edit question
Status:
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-12-12
2018-12-13
 RaiMan (raimund-hocke) said on 2018-12-12: #1

the observation time is the time elapsed, hence including the time spent in the handler.

 ONG YI CHONG (calveeen) said on 2018-12-12: #2

so if the handler takes 0.2s to run at t = 0.5, then once the handler function exits at t = 0.7, the remaining observation time is 0.3s ? During the time spent in the handler no observations will be made ?

 RaiMan (raimund-hocke) said on 2018-12-12: #4

--- so if the handler takes 0.2s to run at t = 0.5, then once the handler function exits at t = 0.7, the remaining observation time is 0.3s ?
yep, this is the meaning of elapsed time.

 ONG YI CHONG (calveeen) said on 2018-12-13: #5

Hmm then what would happen if at t = 0.9 the onChange method is called and the observation time is 1 second and also suppose that handler code takes 0.2 seconds to run then the handler finished at t = 1.1. Would the handler function then cut off at t = 1.0 ?

 RaiMan (raimund-hocke) said on 2018-12-13: #6

--- Would the handler function then cut off
no, since the elapsed time is checked after return from handler.
So in your example the total elapsed time for the complete observation will be 1.1 seconds.