Mercurial > templog
diff server/ts.py @ 40:9b5b202129c3
main.c:
- get rid of some debugging
- separate uart_enabled flag
ts.py:
- remember next wake time, not the interval
log.py:
- comments for sqlite
templog.py
- use cgi
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 23 Jun 2012 22:10:23 +0800 |
parents | 4bfa9b7b2e4b |
children | 26c8ab2ba3f1 |
line wrap: on
line diff
--- a/server/ts.py Sat Jun 16 09:08:47 2012 +0800 +++ b/server/ts.py Sat Jun 23 22:10:23 2012 +0800 @@ -167,6 +167,7 @@ time.sleep(length) def main(): + next_wake_time = 0 while True: sock = None @@ -179,12 +180,13 @@ if sock: next_wake = None try: - next_wake = do_comms(sock) + next_wake_interval = do_comms(sock) + next_wake_time = time.now() + next_wake_interval except Exception, e: print>>sys.stderr, "Error in do_comms:" traceback.print_exc(file=sys.stderr) - if next_wake: - sleep_time = min(next_wake+EXTRA_WAKEUP, sleep_time) + if next_wake_time > time.now(): + sleep_time = min(next_wake_time - time.now() - EXTRA_WAKEUP, sleep_time) if TESTING: print "Sleeping for %d" % sleep_time