view vixm/util.py @ 42:bc6db55448e1 pure

statistics engine
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Sun, 05 Nov 2006 19:25:30 -0500
parents dfcf1a46fc56
children
line wrap: on
line source

# util.py - utility functions
#
# Copyright (C) 2006  Josef "Jeff" Sipek <jeffpc@josefsipek.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

def strtime(t):
	ms = t % 1000
	t /= 1000

	s = t % 60
	t /= 60

	ret = "%02d.%03d" % (s, ms)

	if t != 0:
		m = t
		ret = "%d:%s" % (m, ret)
	
	return ret

def special2int(s):
	if s == '$':
		return -1
	if s == '':
		return 1
	return int(s)

def fixupint(i, m):
	if i == -1:
		return m
	return i