mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-28 05:39:24 +01:00
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.
This commit is contained in:
parent
d1c00ccbaf
commit
13c244c9a7
@ -642,7 +642,7 @@ def standardSubstitute(irc, msg, text, env=None):
|
|||||||
return msg.nick
|
return msg.nick
|
||||||
else:
|
else:
|
||||||
return 'someone'
|
return 'someone'
|
||||||
ctime = time.ctime()
|
ctime = time.strftime("%a %b %d %H:%M:%S %Y")
|
||||||
localtime = time.localtime()
|
localtime = time.localtime()
|
||||||
vars = CallableValueIrcDict({
|
vars = CallableValueIrcDict({
|
||||||
'who': msg.nick,
|
'who': msg.nick,
|
||||||
@ -664,7 +664,7 @@ def standardSubstitute(irc, msg, text, env=None):
|
|||||||
'h': localtime[3], 'hr': localtime[3], 'hour': localtime[3],
|
'h': localtime[3], 'hr': localtime[3], 'hour': localtime[3],
|
||||||
'm': localtime[4], 'min': localtime[4], 'minute': localtime[4],
|
'm': localtime[4], 'min': localtime[4], 'minute': localtime[4],
|
||||||
's': localtime[5], 'sec': localtime[5], 'second': localtime[5],
|
's': localtime[5], 'sec': localtime[5], 'second': localtime[5],
|
||||||
'tz': time.tzname[time.daylight],
|
'tz': time.strftime('%Z', localtime),
|
||||||
})
|
})
|
||||||
if env is not None:
|
if env is not None:
|
||||||
vars.update(env)
|
vars.update(env)
|
||||||
|
Loading…
Reference in New Issue
Block a user