diff py/utils.py @ 145:6517ddee3187

few more bits
author Matt Johnston <matt@ucc.asn.au>
date Thu, 29 Nov 2012 23:50:40 +0800
parents 482d7852b511
children d686b111dab4
line wrap: on
line diff
--- a/py/utils.py	Mon Nov 26 23:21:03 2012 +0800
+++ b/py/utils.py	Thu Nov 29 23:50:40 2012 +0800
@@ -126,4 +126,9 @@
         E("Bad fork()")
         sys.exit(1)
 
+def uptime():
+    try:
+        return float(open('/proc/uptime', 'r').read().split(' ', 1)[0])
+    except Exception, e:
+        return -1