time module

Hi

Does anyone have example of the use of the time module and especially the clock() function. The digi python programming guide has very little about it and I can’t get it working.

I am trying to measure transmission times of my xbee series 2 modules. Is there maybe easier ways to count the time between sendto() and recvfrom() in a loobpack test? Any help or hints or example codes will be very appreciated!

-Matalalento-

Edit.
Never mind to the first question I had again other code disturbing things. Time module works simply importing time and then using time.clock()

Message was edited by: matalalento

Yes, as you discovered - just use. It is quite fast, so ideal for even timeouts in the seconds or minutes range.

Just in case you try time.time() for the date/time, note that it might cause measurable delay due to the need to check the RTC hardware, which can cause a context switch (due to accessing shared hardware resources). So I would only use the time.time() if you really need to know hours of the day, etc.

Yep, thanks for the warning. I am only measuring time between two operations so i dont need actual time of the day. So clock() is ideal for me since i need ms range timing.