changeset 398:c738a52e31e4

handle rem from btoff
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Jul 2012 21:28:49 +0800
parents f1428cddb882
children 744c3c7eb09d
files server/ts.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
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):