From: Gui Chen Date: Fri, 6 Jan 2012 05:34:55 +0000 (+0800) Subject: correct timestamp in logfile X-Git-Tag: 0.4~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3a0a03f7ca62eba0aff350e058e0927988ad675;p=platform%2Fupstream%2Fmic.git correct timestamp in logfile Signed-off-by: Gui Chen --- diff --git a/mic/msger.py b/mic/msger.py index 2a938d3..5f02c29 100644 --- a/mic/msger.py +++ b/mic/msger.py @@ -18,7 +18,7 @@ import os,sys import re -from datetime import datetime +import time __ALL__ = ['set_mode', 'get_loglevel', @@ -41,6 +41,8 @@ ERR_COLOR = 31 # red ASK_COLOR = 34 # blue NO_COLOR = 0 +HOST_TIMEZONE = time.timezone + PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S) INTERACTIVE = True @@ -82,7 +84,9 @@ def _general_print(head, color, msg = None, stream = None, level = 'normal'): save_msg = msg.strip() if save_msg: - timestr = datetime.now().strftime('[%m/%d %H:%M:%S] ') + global HOST_TIMEZONE + timestr = time.strftime("[%m/%d %H:%M:%S] ", + time.gmtime(time.time() - HOST_TIMEZONE)) LOG_CONTENT += timestr + save_msg + '\n' if errormsg: