view vixm/util.py @ 21:dfcf1a46fc56 v0.20

Added GPLv2 file & copyright headers
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Sun, 20 Aug 2006 12:30:19 -0400
parents b5370c42288b
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