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 <jamessan@users.sourceforge.net>
This commit is contained in:
Daniel Folkinshteyn 2010-03-08 16:39:45 -05:00 committed by James Vega
parent fe07ea1146
commit 2c9f325cf4

View File

@ -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)