From 2c9f325cf489570f221695fe07cf4d5f0a43ec47 Mon Sep 17 00:00:00 2001 From: Daniel Folkinshteyn Date: Mon, 8 Mar 2010 16:39:45 -0500 Subject: [PATCH] fix some time display issues in standardsubstitute: first, use explicit time.strftime() instead of time.ctime, since ctime() leaves an extra space between month and date, if date is single-digit. second, use stftime('%Z') for timezone, old code was a bug which always displayed the daylight saving timezone name, even when it wasn't in effect. time.daylight is not a dst flag, it is a flag for whether a dst timezone is /defined/, not if it is in effect. Signed-off-by: James Vega --- src/ircutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ircutils.py b/src/ircutils.py index 4c0aa8a88..5d782f14d 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -642,7 +642,7 @@ def standardSubstitute(irc, msg, text, env=None): return msg.nick else: return 'someone' - ctime = time.ctime() + ctime = time.strftime("%a %b %d %H:%M:%S %Y") localtime = time.localtime() vars = CallableValueIrcDict({ 'who': msg.nick, @@ -664,7 +664,7 @@ def standardSubstitute(irc, msg, text, env=None): 'h': localtime[3], 'hr': localtime[3], 'hour': localtime[3], 'm': localtime[4], 'min': localtime[4], 'minute': localtime[4], 's': localtime[5], 'sec': localtime[5], 'second': localtime[5], - 'tz': time.tzname[time.daylight], + 'tz': time.strftime('%Z', localtime), }) if env is not None: vars.update(env)