Mercurial > templog
comparison py/utils.py @ 551:9499bd2f344b
long polling config updates
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 08 Jun 2015 22:29:46 +0800 |
parents | 5201f441bf4a |
children | 26eee8591f61 |
comparison
equal
deleted
inserted
replaced
550:1040946133ea | 551:9499bd2f344b |
---|---|
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)) |