From 3ea051e6069c5265736cca2f55ac29afcc6e154e Mon Sep 17 00:00:00 2001 From: Go Minoa Date: Sat, 9 Jul 2011 03:53:24 +0000 Subject: [PATCH] Add --timestamp; makes timestamps optional --- BitcoinMiner.py | 15 +++++++++------ README.mkd | 3 ++- poclbm.py | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/BitcoinMiner.py b/BitcoinMiner.py index b363861..63d7379 100644 --- a/BitcoinMiner.py +++ b/BitcoinMiner.py @@ -155,18 +155,21 @@ def __init__(self, device, options): def say(self, format, args=(), sayQuiet=False): if self.options.quiet and not sayQuiet: return with self.outputLock: - p = format % args - pool = self.pool[4]+' ' if self.pool else '' + outp = format % args + if self.options.outStamp: + outp = datetime.now().strftime(TIME_FORMAT) + ' ' + outp + if self.pool: + outp = self.pool[4] + ' ' + outp if self.options.verbose: - print '%s%s,' % (pool, datetime.now().strftime(TIME_FORMAT)), p + print outp else: - sys.stdout.write('\r%s\r%s%s' % (' '*80, pool, p)) + sys.stdout.write('\r%s\r%s' % (' '*80, outp)) sys.stdout.flush() def sayLine(self, format, args=()): if not self.options.verbose: - format = '%s, %s\n' % (datetime.now().strftime(TIME_FORMAT), format) - self.say(format, args) + self.say(format + '\n', args) + else: self.say(format , args) def sayQuiet(self, format, args=()): self.say(format, args, True) diff --git a/README.mkd b/README.mkd index 8ce7c96..822eca7 100644 --- a/README.mkd +++ b/README.mkd @@ -7,6 +7,7 @@ Options: -h, --help show this help message and exit --verbose verbose output, suitable for redirection to log file -q, --quiet suppress all output except hash rate display + -i, --timestamp add timestamp to output --no-server-failbacks disable using failback hosts provided by server @@ -39,4 +40,4 @@ Options: lag -s FRAMESLEEP, --sleep=FRAMESLEEP sleep per frame in seconds, default 0 - -v, --vectors use vectors \ No newline at end of file + -v, --vectors use vectors diff --git a/poclbm.py b/poclbm.py index c7215db..9d15ee2 100755 --- a/poclbm.py +++ b/poclbm.py @@ -10,6 +10,7 @@ parser = OptionParser(version=USER_AGENT, usage=usage) parser.add_option('--verbose', dest='verbose', action='store_true', help='verbose output, suitable for redirection to log file') parser.add_option('-q', '--quiet', dest='quiet', action='store_true', help='suppress all output except hash rate display') +parser.add_option('-i', '--timestamp', dest='outStamp', action='store_true', help='add timestamp to output') group = OptionGroup(parser, "Miner Options") group.add_option('-r', '--rate', dest='rate', default=1, help='hash rate display interval in seconds, default=1', type='float')