comparison py/utils.py @ 253:0a1b642e3086

long polling config updates
author Matt Johnston <matt@ucc.asn.au>
date Mon, 08 Jun 2015 22:29:46 +0800
parents 185621f47040
children 26eee8591f61
comparison
equal deleted inserted replaced
251:b6079cb0c665 253:0a1b642e3086
2 import sys 2 import sys
3 #import ctypes 3 #import ctypes
4 import time 4 import time
5 import select 5 import select
6 import logging 6 import logging
7 import binascii
7 8
8 D = logging.debug 9 D = logging.debug
9 L = logging.info 10 L = logging.info
10 W = logging.warning 11 W = logging.warning
11 E = logging.error 12 E = logging.error
131 try: 132 try:
132 return float(open('/proc/uptime', 'r').read().split(' ', 1)[0]) 133 return float(open('/proc/uptime', 'r').read().split(' ', 1)[0])
133 except Exception as e: 134 except Exception as e:
134 return -1 135 return -1
135 136
137 def hexnonce():
138 return binascii.hexlify(os.urandom(120))