diff server/ts.py @ 92:c3eb67cd8b61

handle rem from btoff
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Jul 2012 21:28:49 +0800
parents 231662c6690c
children 229b740a607f
line wrap: on
line diff
--- a/server/ts.py	Mon Jul 16 21:24:43 2012 +0800
+++ b/server/ts.py	Mon Jul 16 21:28:49 2012 +0800
@@ -106,7 +106,16 @@
 
     toks = dict(v.split('=') for v in l.split(','))
 
-    return int(toks['next_wake'])
+    rem = int(toks['rem'])
+    tick_secs = int(toks['tick_secs'])
+    tick_secs = int(toks['tick_wake'])
+    next_wake = int(toks['next_wake'])
+
+    rem_secs = float(rem) / tick_wake * tick_secs
+
+    next_wake_secs = next_wake - rem_secs
+    L("next_wake_secs %f\n", next_wake_secs)
+    return next_wake_secs
 
 @retry()
 def clear_meas(sock):