This loops every 5 seconds regardless of how long the remainder of the loop
takes (as long as it is somewhat less than 5 seconds)
from time import time, sleep
next_time = time()+5
while True:
sleep(next_time-time())
next_time+=5
# ...
Cheers,
John La Rooy
On Mon, Jul 4, 2011 at 10:52 PM, Massimo Di Pierro <
[email protected]> wrote:
> You should run a background process that does it
>
> white True:
> sleep(5)
> ....
>
>
>
> On Jul 4, 7:47 am, Valter Foresto <[email protected]> wrote:
> > It is possible to call from inside WEB2PY a 'short user function' based
> on
> > time tick periodically (like any 0.05 ... 5 seconds) ?
> >
> > This functionality can be very usefull to collect data from the field
> (for
> > example from equipments on the Ethernet LAN or on the Internet or simply
> > attached to the Server), execute some short algorithm on the readed data
> and
> > then store results on the database using DAL.
> > Users can access and see database contents from the web using MVC in
> WEB2PY.
> > In other words, WEB2PY will be used to do acquisition, processing,
> storage
> > and presentation of field data over the web and the Internet ?
>