#!/usr/bin/env python import sys import string sys.path.insert(0,'/usr/local/lib') import modunits ignore=0 def usage(retval): sys.stderr.write('Usage: %s [-i]\n' % sys.argv[0]) sys.stderr.write('-i says to ignore lines that cannot be converted to a floating point number - IE, do not error out\n') sys.exit(retval) while 1: line = sys.stdin.readline() if not line: break try: f = string.atof(string.strip(line)) except: sys.stderr.write('Could not convert %s to a float\n' % string.strip(line)) if not ignore: sys.exit(1) else: print modunits.modunits('time',int(f))