# Integration of python's time.time() and work() calls

**URL:** <https://www.ruby-forum.com/t/integration-of-pythons-time-time-and-work-calls/242106>\
**Category:** GNU Radio\
**Created:** [May 27, 2015, 7:47pm UTC](https://www.ruby-forum.com/t/integration-of-pythons-time-time-and-work-calls/242106 "2015-05-27T19:47:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 27, 2015, 7:47pm UTC](https://www.ruby-forum.com/t/integration-of-pythons-time-time-and-work-calls/242106/1 "2015-05-27T19:47:19Z")

</div>

Hi

I’m writing a custom block in python. The application goes like this:

I specify the minimum number of samples I need by using the forecast  
function. This ensures that I have that many samples available in the  
in-buffer of the block every time work is called. Once I have as many  
samples as I need, I slide a window over the samples. In each window  
slide  
I measure signal power. If power less than a pre-set threshold (I assume  
only noise is being received), do nothing. Keep sliding.

The moment power exceeds the threshold for the first time, I have to  
start  
measuring time. I need to see how many windows I’m able to slide in the  
next let’s say, 10 milliseconds (because I expect that the actual signal  
transmission is to last for that long). As a hypothetical example, let’s  
say by 7 milliseconds I’ve reached the end of the buffer. If my  
understanding is correct, once I reach the end, the next set of samples  
come in (as per forecast) and work is called again. My question is how  
do I  
make this next work call aware of this concept of time and that 3  
milliseconds were unaccounted for in the last call?

Or is there a way to make sure that the in-buffer gets updated multiple  
times within the same work call?

Thanks  
Anil
