summaryrefslogtreecommitdiff
path: root/tko/utils.py
blob: 42815b9a07bb6c53d35069f3b8d935c1d9dd73e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys, datetime


_debug_logger = sys.stderr
def dprint(msg):
	print >> _debug_logger, msg


def redirect_parser_debugging(ostream):
	global _debug_logger
	_debug_logger = ostream


def get_timestamp(mapping, field):
	val = mapping.get(field, None)
	if val is not None:
		val = datetime.datetime.fromtimestamp(int(val))
	return val