diff options
author | Frederic Leger | 2016-07-07 09:18:03 +0000 |
---|---|---|
committer | Frederic Leger | 2016-07-07 09:18:03 +0000 |
commit | 72c9f8995912207a44d31c82f74056248e882dba (patch) | |
tree | 58e4f7c74b1b3138b6abeffa80d505df8d56bab0 /python/src/tcf/util/logging.py | |
parent | 69846a1fda38662c05543d5b584086cf0fbc8406 (diff) | |
download | org.eclipse.tcf-72c9f8995912207a44d31c82f74056248e882dba.tar.gz org.eclipse.tcf-72c9f8995912207a44d31c82f74056248e882dba.tar.xz org.eclipse.tcf-72c9f8995912207a44d31c82f74056248e882dba.zip |
TCF Python: Python 3 compliance.
The whole TCF python code should now be python 2 AND python 3
compatible.
As there are few tests, I made sure this works by running the
BasicTests.py and ProcessStart.py using both a python2 or python3
interpreter.
Diffstat (limited to 'python/src/tcf/util/logging.py')
-rw-r--r-- | python/src/tcf/util/logging.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/python/src/tcf/util/logging.py b/python/src/tcf/util/logging.py index 889ff3dd7..132daa931 100644 --- a/python/src/tcf/util/logging.py +++ b/python/src/tcf/util/logging.py @@ -1,5 +1,5 @@ # ***************************************************************************** -# * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. +# * Copyright (c) 2011, 2013, 2016 Wind River Systems, Inc. and others. # * All rights reserved. This program and the accompanying materials # * are made available under the terms of the Eclipse Public License v1.0 # * which accompanies this distribution, and is available at @@ -11,7 +11,6 @@ "Internal utility methods used for logging/tracing." -import cStringIO import locale import time @@ -30,24 +29,24 @@ def getDebugTime(): the relative time between two events, since the counter will flip to zero roughly every 16 minutes. """ - traceBuilder = cStringIO.StringIO() + traceBuilder = '' # Record the time tm = int(time.time() * 1000) - seconds = (tm / 1000) % 1000 + seconds = int((tm / 1000)) % 1000 if seconds < 100: - traceBuilder.write('0') + traceBuilder += '0' if seconds < 10: - traceBuilder.write('0') - traceBuilder.write(str(seconds)) - traceBuilder.write(DECIMAL_DELIMITER) + traceBuilder += '0' + traceBuilder += str(seconds) + traceBuilder += str(DECIMAL_DELIMITER) millis = tm % 1000 if millis < 100: - traceBuilder.write('0') + traceBuilder += '0' if millis < 10: - traceBuilder.write('0') - traceBuilder.write(str(millis)) - return traceBuilder.getvalue() + traceBuilder += '0' + traceBuilder += str(millis) + return traceBuilder def trace(msg): |